Search code examples
c#pdfcrystal-reportsreportdocument

Where are the default ExportOptions in the crystal ReportDocument object


I'm using CR for VS2010 to programmatically generate PDF and Excel documents from Crystal Report files. For some reports in Crystal Reports 2008 they have 'Create bookmarks from group tree' checked under:

File > Export > Export Options > PDF Format

I want to export with that option if that particular report has that checkmarked, but I cannot find that reflected anywhere in the ReportClass object. How can I tell if an .rpt file has that selected? Or does the ReportClass object not retrieve that from the .rpt file?

Pseudo-code below:

 using (var report = new ReportClass { FileName = "C:/Reports/" + name + ".rpt" })
        {
            report.Load();
            /* set connections */

            /* set parameters */

            /* set the export type */

            /* set the content type and export options */

            if (showBookmarksForPDF && exportType == ExportFormatType.PortableDocFormat)
                AdjustExportOptions();


            /* export to stream */

            return new FileStreamResult(stream, contentType);
        }

Note: i can add the bookmarks just fine, but i only want to do so to the rpt's that want it


Solution

  • I'm sorry but I think that the ReportClass object does not inherit this data from the .rpt file.enter image description here

    I guess this data can only be set but not retrieved directly. You can use other ways to go around that, by marking that in the file name for example.