[]
        
(Showing Draft Content)

Excel Export

Microsoft Excel is one of the formats to which you can render your report using ExcelRenderingExtension. You can export Excel files in two formats, i.e. Xls and Xlsx.

Excel Rendering Properties

ActiveReports offers several options to control how reports render to Microsoft Excel.

Property

Description

Author

Gets or sets the name of the author of the document.

Categories

Sets the name of the categories that appears in the Categories field in the Properties of the exported Excel document.

FileFormat

Specifies the output format of the Excel document, i.e. Xls or Xlsx.

OpenXmlStandard

Specifies the level of Open XML document conformance on exporting in Xlsx file format. You can choose from the following values: * Strict: The default value. * Transitional: The Excel file generated by scheduled task execution using Strict (the default value of OpenXMLStandard) cannot be viewed on IOS devices.

PageSettings

Returns an ExcelRenderingExtensionPageSettings object for initializing Excel file print setting.

Pagination

Forces pagination or galley report layout mode.

RightToLeft

Shows direction of sheets from right to left.

Security

Returns an ExcelRenderingExtensionSecurity object for initializing document security.

SheetMode

Indicates how to split the report pages into the excel sheets. You can choose from the following modes: * PagePerSheet: Each report page is exported to a separate Excel sheet * SectionPerSheet: Each report section is exported to a separate Excel sheet * SingleSheet: Entire report is exported to a single Excel sheet

SheetName

Indicates the name of the sheet.

Title

Gets or sets the title of the document.

UseCompression

Indicates whether to use compression when exporting document to an Xlsx file.

UseDefaultPalette

Indicates whether to export the document with the default Excel palette.

Interactivity

Reports rendered in Excel support a number of interactive features like Bookmarks and Hyperlinks. However, in case you have any data hidden at the time of rendering (like in a drill-down report), it does not show up in the output. It is recommended that you expand all toggle items prior to rendering.

Limitations

  • BackgroundImage and rounded corners (for Shape and Container) are not exported.

  • Overlapping controls are not supported and an incorrect result will be obtained in the case of export.

  • LineSpacing is not retained after export.

  • Exported FormattedText control does not preserve styles and formatting. It exports FormattedText as TextBox with plain text without any tags.

  • Barcodes are exported as an image object so scanning of barcode images may fail in some cases. It depends on printer settings and the scanner quality. Barcodes may be blurred on export and the caption may get truncated in case of physical printing.

  • Exported Boolean values are displayed in uppercase in both Xls and Xlsx files.

  • TextIndent and FillCharacter properties of the TableOfContents control's Level setting are not supported.

  • Text decoration (Underline and LineThrough) gets applied to the indented area when left padding is applied to the TableOfControl's levels.

  • When a report is exported to Excel, CharWrap mode is ignored.

  • The following properties of ActiveReports are not exported to Excel, since Excel does not have such settings:

    • CharacterSpacing

    • BorderWidth

    • MinCondenseRate

Export Report using Excel Rendering Extension

The following steps provide an example of rendering a report in Microsoft Excel format.

  1. Create a new or open an existing Windows Forms App in Visual Studio project.

  2. Go to the Project Explorer, right-click the project and select Add > New Item.

  3. Select ActiveReports 19 Standalone Report > Add and choose a report type, RDLX, RDLX Dashboard, or Page report and then click Finish.

  4. Add a reference to MESCIUS.ActiveReports.Export.Excel package in the project.

  5. On the Form.cs or Form.vb that opens, double-click the title bar to create the Form_Load event.

  6. Add the following code inside the Form_Load event.

    ' Provide the Page report you want to render.
    
    Dim rptPath As New IO.FileInfo("..\..\..\Report1.rdlx")
    
    Dim pageReport As New GrapeCity.ActiveReports.PageReport(rptPath)
    
    ' Create an output directory.
    Dim outputDirectory As New System.IO.DirectoryInfo("C:\MyExcel")
    outputDirectory.Create()
    
    ' Provide settings for your rendering output.
    Dim excelSetting As New GrapeCity.ActiveReports.Export.Excel.Page.ExcelRenderingExtensionSettings()
    excelSetting.FileFormat = GrapeCity.ActiveReports.Export.Excel.Page.FileFormat.Xls
    Dim setting As GrapeCity.ActiveReports.Extensibility.Rendering.ISettings = excelSetting
    
    ' Set the rendering extension and render the report.
    Dim excelRenderingExtension As New GrapeCity.ActiveReports.Export.Excel.Page.ExcelRenderingExtension()
    Dim outputProvider As New GrapeCity.ActiveReports.Rendering.IO.FileStreamProvider(outputDirectory, System.IO.Path.GetFileNameWithoutExtension(outputDirectory.Name))
    
    ' Overwrite output file if it already exists.
    outputProvider.OverwriteOutputFile = True
    
    pageReport.Document.Render(excelRenderingExtension, outputProvider, setting.GetSettings())
    // Provide the Page report you want to render.
    System.IO.FileInfo rptPath = new System.IO.FileInfo(@"..\..\..\Report1.rdlx");
    
    GrapeCity.ActiveReports.PageReport pageReport = new GrapeCity.ActiveReports.PageReport(rptPath);
    
    // Create an output directory.
    System.IO.DirectoryInfo outputDirectory = new System.IO.DirectoryInfo(@"C:\MyExcel");
    outputDirectory.Create();
    
    // Provide settings for your rendering output.
    GrapeCity.ActiveReports.Export.Excel.Page.ExcelRenderingExtensionSettings excelSetting = new GrapeCity.ActiveReports.Export.Excel.Page.ExcelRenderingExtensionSettings();
    excelSetting.FileFormat = GrapeCity.ActiveReports.Export.Excel.Page.FileFormat.Xls;
    GrapeCity.ActiveReports.Extensibility.Rendering.ISettings setting = excelSetting;
    
    // Set the rendering extension and render the report.
    GrapeCity.ActiveReports.Export.Excel.Page.ExcelRenderingExtension excelRenderingExtension = new GrapeCity.ActiveReports.Export.Excel.Page.ExcelRenderingExtension();
    GrapeCity.ActiveReports.Rendering.IO.FileStreamProvider outputProvider = new GrapeCity.ActiveReports.Rendering.IO.FileStreamProvider(outputDirectory, System.IO.Path.GetFileNameWithoutExtension(outputDirectory.Name));
    
    // Overwrite output file if it already exists.
    outputProvider.OverwriteOutputFile = true;
    
    pageReport.Document.Render(excelRenderingExtension, outputProvider, setting.GetSettings());