Solved

How to export HTML from Crystal report to a different file path than specified by Crystal

Posted on 2008-10-24
5
368 Views
Last Modified: 2013-11-26
I am exporting an HTML file from VS2005 using the Crystal that ships with VS2005.  If I follow the documentation provided by Crystal, the files get exported to a folder called "HTML32Folder" & "TheNameoftheReport".  If I do not use the "HTML32Folder" file path, the file gets written to the visual studio project path.  I have tried the code on the MSDN site, and that also exports it to the project path.  This is the code that MSDN has, but the file always goes to the visual studio project path:
'Dim htmlOpts As HTMLFormatOptions = ExportOptions.CreateHTMLFormatOptions()
        'Dim diskOpts As DiskFileDestinationOptions = ExportOptions.CreateDiskFileDestinationOptions()
        'Dim exportOpts As New ExportOptions()
        'Dim file As String
        'file = theFilePath & theFileName & ".html"

        'htmlOpts.HTMLFileName = File
        'htmlOpts.HTMLEnableSeparatedPages = False
        'htmlOpts.HTMLHasPageNavigator = False
        'exportOpts.ExportFormatOptions = htmlOpts

        'diskOpts.DiskFileName = File
        'exportOpts.ExportDestinationOptions = diskOpts

        'exportOpts.ExportDestinationType = _
        '   ExportDestinationType.DiskFile
        'exportOpts.ExportFormatType = _
        '   ExportFormatType.HTML32

        'Me.Export(exportOpts)

How do I export the HTML file to a folder other than the "HTML32Folder" & "TheNameoftheReport" path?  Thank you.
0
Comment
Question by:KMBrochu
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 101

Expert Comment

by:mlmcc
ID: 22798239
Have you tried using

diskOpts.DiskFileName = 'C:\MyDirectory\MyReports\Exported\MyReport.html'

mlmcc
0
 

Author Comment

by:KMBrochu
ID: 22798467
Yes, it will still put the file in the project directory.
0
 
LVL 101

Expert Comment

by:mlmcc
ID: 22798691
I assume you removed the ' from the front of the code.  Otherwise they are comments.

According to this document that is the line to change.  Export starts on page 191

http://www.businessobjects.com/global/pdf/dev_zone/VS2005_Walkthroughs.pdf

mlmcc
0
 
LVL 27

Accepted Solution

by:
VBRocks earned 125 total points
ID: 22799681
Yes, you can do this.  Here's an example of exporting a report that I made using DataSet1 as it's datasource:

        Dim ds As New DataSet1()

        'Load data
        For i As Integer = 1 To 10
            ds.Tables(0).Rows.Add(New Object() {i})
        Next

        Dim rpt As New CrystalReport1()
        rpt.SetDataSource(ds)

        '*** Export to specified path here ***
        rpt.ExportToDisk(CrystalDecisions.Shared.ExportFormatType.HTML40, "c:\temp\myreport.html")

        MsgBox("done")

0
 

Author Closing Comment

by:KMBrochu
ID: 31509706
Thank you, this worked.
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In my previous article (http://www.experts-exchange.com/Programming/Languages/.NET/.NET_Framework_3.x/A_4362-Serialization-in-NET-1.html) we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

718 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question