Solved

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

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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Header Font Size in Grid View 6 45
.NET - find out if application is running on Windows 2012 server 3 55
CSS question 16 59
What are MicroServices? 4 65
The object model of .Net can be overwhelming at times – so overwhelming that quite trivial tasks often take hours of research. In this case, the task at hand was to populate the datagrid from SQL Server database in Visual Studio 2008 Windows applica…
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 …
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

738 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