Solved

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

Posted on 2008-10-24
5
363 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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

770 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