Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 9129

Re: How to modify sub-report location with C#

$
0
0

Hi Don, I tried to export to RPT, but somehow the output file cannot be opened. I modified the existing code for PDF export. It works for PDF prefecture. I didn't make any change on the report. I just tried to load and export the same file.

 

 

CrystalDecisions.CrystalReports.Engine.ReportDocument cryRpt = new CrystalDecisions.CrystalReports.Engine.ReportDocument();

 

cryRpt.Load(tempaltePath);

cryRpt.SetParameterValue("DATASET_ID", DatasetId);

 

 

try

            {

                var crDiskFileDestinationOptions = new DiskFileDestinationOptions { DiskFileName = @"C:\test.rpt" }; // It was .pdf

                var crExportOptions = cryRpt.ExportOptions;

                {

                    crExportOptions.ExportDestinationType = ExportDestinationType.DiskFile;

                    crExportOptions.ExportFormatType = ExportFormatType.CrystalReport; // it was ExportFormatType.PortableDocFormat

                    crExportOptions.DestinationOptions = crDiskFileDestinationOptions;

                    crExportOptions.FormatOptions = new ExportOptions(); // it was PdfRtfWordFormatOptions()

                }

                cryRpt.Export();

            }

            catch (Exception ex)

            {

                Console.WriteLine(ex.ToString());

            }


Viewing all articles
Browse latest Browse all 9129

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>