How to export a crystal report to a file ... [Sea wave .NET]

xiaoxiao2021-03-06  102

Haibo .NET Problem: How to export crystal reports to files ... --------------------------------- ------------- Solution: 1. ExportFormatType enumeration CRYSTALDECSIONS.SHARED Name Space | ExportOptions Member Name Description The export format of the Excel report is Microsoft Excel file. The export format of the HTML32 report is the HTML 3.2 file. The export format of the HTML40 report is the HTML 4.0 file. NOFORMAT does not specify the export format. The export format of the PortableDocFormat report is a PDF file. The export format of the RichText report is the Rich Text file. The export format of the WordforWindows report is the Microsoft Word file.

2, Private Sub EXPORTTODISK (Byval FileName As String) 'declares the variable and get the export option. DIM EXPORTOPTS As New ExportOptions () DIM DISKOPTS As New DiskFileDestinationOptions () Exportopts = Report.ExportOptions

'Set the export format. Exportopts.exportFormattype = _ exportformattype.richtext exportopts.exportDestinationType = _ exportDestinationType.Diskfile

'Set the disk file option. Diskopts.diskFileName = filename exportopts.destinationOptions = Diskopts

'Export report. Report.export () End Sub [C #] Private Void ExpostTodisk (String FileName) {// Declared Variables and Get Export Options. EXPORTOPTIONOPTIONS (); diskFileDestinationOptions (); new diskfileDESTINATIONOPTIONOPTIONS (); exportopts = report.exportOptions;

/ / Set the export format. Exportopts.exportFormattype = ExportFormattype.richtext; exportopts.exportDestinationType = ExportDestinationType.diskFile;

// Set the disk file option. Diskopts.diskFileName = filename; exportopts.destinationOptions = diskopts;

// Export the report. Report.export ();} [c ] void exporttodisk (String * filename) {// declared variables and gains the export options. CrystalDecisions :: Shared :: ExportOptions * exportOpts = new CrystalDecisions :: Shared :: ExportOptions (); CrystalDecisions :: Shared :: DiskFileDestinationOptions * diskOpts = new CrystalDecisions :: Shared :: DiskFileDestinationOptions (); exportOpts = Report-> ExportOptions; / / Set the export format. EXPORTOPTS-> EXPORTFORMATTYPE = ExportFormattype :: Richtext; Exportopts-> ExportDestinationType = ExportDestinationTYPE :: DiskFile;

// Set the disk file option. Diskopts-> diskfilename = filename; exportopts-> destinationOptions = diskopts;

// Export the report. Report-> EXPORT ();

转载请注明原文地址:https://www.9cbs.com/read-103410.html

New Post(0)