Export Crystal Report to txt file
-
Hi In VB 6 I used to export crystal report to almost any type This sample “export report to txt file” Dim myExportFile As String myExportFile = App.Path + "\temp.xls" Report.ExportOptions.DiskFileName = myExportFile Report.ExportOptions.FormatType = crEFTText Report.ExportOptions.DestinationType = crEDTDiskFile Report.ExportOptions.RTFExportAllPages = True Report.Export (False) But in Visual Studio 2003 I can't Export to plain txt file Check out this code, // Set the Export type, this can be: // PDF, Excel, Word Doc, RTF Doc, // HTML 3.2, HTML 4.0 or CrystalReport no txt file // The path/location where the exported file will be saved string exportFilePath = MY_PATH+"\\RPTFOH\\Report1.DOC"; // Create an instance of the untyped report object ReportDocument oRpt = new ReportDocument(); // Load the report from disk oRpt.Load(@"C:\Test\RPTFOH\Report_1.rpt"); // Set the options for saving the exported file to disk DiskFileDestinationOptions oDest = new DiskFileDestinationOptions(); oDest.DiskFileName = exportFilePath; // Set the exporting information ExportOptions oExport = oRpt.ExportOptions; // Set the destination options oExport.DestinationOptions = oDest; // Set the location, this can be: // DiskFile, ExchangeFolder, MicrosoftMail or NoDestination oExport.ExportDestinationType = ExportDestinationType.DiskFile; // Set the Export type, this can be: // PDF, Excel, Word Doc, RTF Doc, // HTML 3.2, HTML 4.0 or CrystalReport oExport.ExportFormatType = ExportFormatType.WordForWindows; // Call the Export method to export the report oRpt.Export(); Please it's urgent, I need to export Report to txt file. Thanks in advance.
-
Hi In VB 6 I used to export crystal report to almost any type This sample “export report to txt file” Dim myExportFile As String myExportFile = App.Path + "\temp.xls" Report.ExportOptions.DiskFileName = myExportFile Report.ExportOptions.FormatType = crEFTText Report.ExportOptions.DestinationType = crEDTDiskFile Report.ExportOptions.RTFExportAllPages = True Report.Export (False) But in Visual Studio 2003 I can't Export to plain txt file Check out this code, // Set the Export type, this can be: // PDF, Excel, Word Doc, RTF Doc, // HTML 3.2, HTML 4.0 or CrystalReport no txt file // The path/location where the exported file will be saved string exportFilePath = MY_PATH+"\\RPTFOH\\Report1.DOC"; // Create an instance of the untyped report object ReportDocument oRpt = new ReportDocument(); // Load the report from disk oRpt.Load(@"C:\Test\RPTFOH\Report_1.rpt"); // Set the options for saving the exported file to disk DiskFileDestinationOptions oDest = new DiskFileDestinationOptions(); oDest.DiskFileName = exportFilePath; // Set the exporting information ExportOptions oExport = oRpt.ExportOptions; // Set the destination options oExport.DestinationOptions = oDest; // Set the location, this can be: // DiskFile, ExchangeFolder, MicrosoftMail or NoDestination oExport.ExportDestinationType = ExportDestinationType.DiskFile; // Set the Export type, this can be: // PDF, Excel, Word Doc, RTF Doc, // HTML 3.2, HTML 4.0 or CrystalReport oExport.ExportFormatType = ExportFormatType.WordForWindows; // Call the Export method to export the report oRpt.Export(); Please it's urgent, I need to export Report to txt file. Thanks in advance.
Hi! Because one of the export formats is RTF you could use this to create an rtf file. This file can be read by a
RichTextBox
and saved as plain text. Hope this helps, mav