Solved

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

Posted on 2008-10-24
5
358 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
  • 2
  • 2
5 Comments
 
LVL 100

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 100

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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
There have always been a lot of questions related to when Crystal Reports evaluates report components (such as formulas, summaries, cross-tabs, charts, to name a few examples). Crystal Reports uses a two-pass reporting process to provide greater …
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

757 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now