Search results
PDF

Export report

The Report Viewer provides events and properties to control and customize the exporting functionality.

PDF export options

The PDFOptions provides properties to manage PDF export behaviors. You have to set the properties in the application window loaded method.

Export with complex scripts

To export reports with the complex scripts, set the EnableComplexScript property of PDFOptions instance to true.

this.reportViewer.PDFOptions = new BoldReports.Writer.PDFOptions()
{
    EnableComplexScript = true
};

PDF Conformance

You can export the report as PDF/A-1b document by specifying the conformance level PdfConformanceLevel.Pdf_A1B in the PdfConformanceLevel property.

this.reportViewer.PDFOptions = new BoldReports.Writer.PDFOptions()
{
    PdfConformanceLevel = Syncfusion.Pdf.PdfConformanceLevel.Pdf_A1B
};

Word export options

The WordOptions provides properties to manage Word document export behaviors.

Word document type

You can save the report to the required document version by setting the FormatType property.

this.reportViewer.WordOptions = new BoldReports.Writer.WordOptions();
this.reportViewer.WordOptions.FormatType = BoldReports.Writer.WordFormatType.Docx;

Word document advance layout for merged cells

Eliminate the tiny columns, rows, merged cells, and render the word document elements without nested grid layout by setting the LayoutOption as TopLevel. The ParagraphSpacing is the distance value added between two elements in the document.

this.reportViewer.WordOptions = new BoldReports.Writer.WordOptions();
this.reportViewer.WordOptions.LayoutOption = BoldReports.Writer.WordLayoutOptions.TopLevel;
this.reportViewer.WordOptions.ParagraphSpacing = new BoldReports.Writer.ParagraphSpacing()
{
    Bottom = 0.5f,
    Top = 0.5f
};

A paragraph element is inserted between two tables in the exported document to overcome word document auto merging behavior. The table in word document is not a stand-alone object, if you draw two tables one after another, it will automatically get merged into a single table. To prevent this merging, added an empty paragraph between two tables.

Protecting Word document from editing

You can restrict a Word document from editing either by providing a password or without a password. The following are the types of protection.

  1. AllowOnlyComments: You can add or modify only the comments in the Word document.
  2. AllowOnlyFormFields: You can modify the form field values in the Word document.
  3. AllowOnlyRevisions: You can accept or reject the revisions in the Word document.
  4. AllowOnlyReading: You can only view the content in the Word document.
  5. NoProtection: You can access or edit the Word document contents as normally.
this.reportViewer.WordOptions = new BoldReports.Writer.WordOptions();
this.reportViewer.WordOptions.ProtectionType = Syncfusion.DocIO.ProtectionType.AllowOnlyReading;

Excel export options

The ExcelOptions provides properties to manage Excel document export behaviors.

Excel document type

You can save the report to the required excel version by setting the ExcelSaveType property.

this.reportViewer.ExcelOptions = new BoldReports.Writer.ExcelOptions();
this.reportViewer.ExcelOptions.ExcelSaveType = BoldReports.Writer.ExcelVersion.Excel2013;

Excel document advance layout for merged cells

Eliminate the tiny columns, rows, and merged cells to provide clear readability and perform data manipulations by setting the LayoutOption as IgnoreCellMerge.

this.reportViewer.ExcelOptions = new BoldReports.Writer.ExcelOptions();
this.reportViewer.ExcelOptions.LayoutOption = BoldReports.Writer.ExcelLayoutOptions.IgnoreCellMerge;

Protecting Excel document from editing

You can restrict the Excel document from editing either by providing the ExcelSheetProtection or enabling the ReadOnlyRecommended properties.

this.reportViewer.ExcelOptions = new BoldReports.Writer.ExcelOptions()
{
    ReadOnlyRecommended = true,
    ExcelSheetProtection = Syncfusion.XlsIO.ExcelSheetProtection.DeletingColumns
};

PowerPoint export options

You can save the report to the required PowerPoint version by setting the FormatType property.

this.reportViewer.PPTOptions = new BoldReports.Writer.PPTOptions();
this.reportViewer.PPTOptions.FormatType = BoldReports.Writer.PPTSaveType.PowerPoint2013;

CSV export options

The CsvOptions allows you to change encoding, delimiters, qualifiers, extension, and line break of a CSV exported document.

this.reportViewer.CsvOptions = new BoldReports.Writer.CsvOptions()
{
    Encoding = System.Text.Encoding.Default,
    FieldDelimiter = ",",
    UseFormattedValues = false,
    Qualifier = "#",
    RecordDelimiter = "@",
    SuppressLineBreaks = true,
    FileExtension = ".txt"
};

HTML export options

You can hide the separator added at the end of each page by setting the HidePageSeparator property to true.

this.reportViewer.HTMLOptions = new BoldReports.Writer.HTMLOptions();
this.reportViewer.HTMLOptions.HidePageSeparator = true;

Password protect exported document

This allows you to protect the exported document such as PDF, Word, Excel, and PowerPoint from unauthorized users by encrypting the document using encryption password. The following code snippet illustrates how to encrypt the exported document with the user defined password.

//PDF encryption
this.reportViewer.PDFOptions = new BoldReports.Writer.PDFOptions();
this.reportViewer.PDFOptions.Security = new Syncfusion.Pdf.Security.PdfSecurity()
{
    UserPassword = "Password"
};

//Word encryption
this.reportViewer.WordOptions = new BoldReports.Writer.WordOptions()
{
    EncryptionPassword = "password"
};

//Excel encryption
this.reportViewer.ExcelOptions = new BoldReports.Writer.ExcelOptions()
{
    PasswordToModify = "password",
    PasswordToOpen = "password"
};

//PPT encryption
this.reportViewer.PPTOptions = new BoldReports.Writer.PPTOptions()
{
    EncryptionPassword = "password"
};

Password protection is not supported for HTML export format.

Change file name in export

You can change the file name of report in export using the FileName property.

this.reportViewer.ExportSettings = new BoldReports.Writer.ExportSettings();
this.reportViewer.ExportSettings.FileName = "Invoice";

Change image quality in export

You can change image quality of data visualization items in report export using the ImageQuality property.

this.reportViewer.ExportSettings = new BoldReports.Writer.ExportSettings();
this.reportViewer.ExportSettings.ImageQuality = 4;