XLSX is a format that opens in Microsoft Excel as a spreadsheet. This export does not render reports exactly as they appear in the Viewer due to inherent differences in the formats. The XLSX export filter has a number of useful properties that allow you to control your output. You can set the properties either in code using the XLSExport object after adding reference to MESCIUS.ActiveReports.Export.Excel package in your project.
The Excel export now supports the CrossPlatform compatibility mode.
Property | Valid Values | Description |
---|---|---|
AutoRowHeight | True or False (default) | Set to True to have Excel set the height of rows based on the contents. Otherwise XlsExport calculates the height of rows. In some cases this may make the output look better inside Excel. However, a value of True may adversely affect pagination when printing, as it may stretch the height of the page. |
DisplayGridLines | True (default) or False | Set to False to hide grid lines in Excel. |
FileFormat | Xls97Plus (default) or Xls95 or Xlsx |
Set to Xls95 to use Microsoft Excel 95, Xls95Plus to use Microsoft Excel 97and Xlsx to use Microsoft Excel 2007 or newer. |
MinColumnWidth | Single (VB) or float (C#) |
Set the number of inches that is the smallest width for a column in the exported spreadsheet. Tip: Larger values reduce the number of empty columns in a sheet. Set this value to 1 inch or more to get rid of small empty columns. |
MinRowHeight | Single (VB) or float (C#) |
Set the number of inches that is the smallest height for a row in the exported spreadsheet. Tip: Larger values force the export to place more controls on a single line by reducing the number of rows added to match blank space. Set this value to .25 inches or more to get rid of small empty rows. |
MultiSheet | True or False (default) |
Set to True to export each page of your report to a separate sheet within the Excel file. This can increase performance and output quality at the cost of memory consumption for reports with complex pages and a lot of deviation between page layouts. In general, use False for reports with more than 30 pages. |
OpenXmlStandard | Strict or Transitional (default) |
Specifies the level of Open XML document conformance on exporting in Xlsx file format. You can choose from the following values:
|
Set a print orientation and paper size of Excel sheet. | ||
True (default) or False | Forces pagination or galley report layout mode. This property is only useful for Page/RDLX reports exports through RDF and does not affect a section report. | |
RemoveVerticalSpace | True or False (default) | Set to True to remove vertical empty spaces from the spreadsheet. This may improve pagination for printing. |
Security | Set a password and username to protect the excel spreadsheet. | |
SheetName | Specifies the name of the sheet. | |
UseCellMerging | True or False (default) | Set to True to merge cells where applicable. |
UseCompression | True or False (default) | Indicates whether to use compression on exporting an Xlsx file. |
UseDefaultPalette | True or False (default) | Set to True to export document with Excel default palette. |
Usage:
Does not support:
Use the following steps to export reports through Excel export filters.
Visual Basic.NETcode. Paste INSIDE the Form_Load event |
Copy Code
|
---|---|
' Create a Section report. Dim rpt As New GrapeCity.ActiveReports.SectionReport() ' For the code to work, report.rpx must be placed in the bin\debug folder of your project. Dim xtr As New System.Xml.XmlTextReader(Application.StartupPath + "\report.rpx") rpt.LoadLayout(xtr) rpt.Run() ' Export the report in Excel format. Dim XlsExport1 As New GrapeCity.ActiveReports.Export.Excel.Section.XlsExport() ' Set a file format of the exported excel file to Xlsx to support Microsoft Excel 2007 and newer versions. XlsExport1.FileFormat = GrapeCity.ActiveReports.Export.Excel.Section.FileFormat.Xlsx XlsExport1.Export(rpt.Document, Application.StartupPath + "\XLSExpt.xlsx") |
C# code. Paste INSIDE the Form_Load event. |
Copy Code
|
---|---|
// Create a Section Report GrapeCity.ActiveReports.SectionReport rpt = new GrapeCity.ActiveReports.SectionReport(); // For the code to work, report.rpx must be placed in the bin\debug folder of your project. System.Xml.XmlTextReader xtr = new System.Xml.XmlTextReader(Application.StartupPath + "\\report.rpx"); rpt.LoadLayout(xtr); rpt.Run(); // Export the report in XLSX format. GrapeCity.ActiveReports.Export.Excel.Section.XlsExport XlsExport1 = new GrapeCity.ActiveReports.Export.Excel.Section.XlsExport(); // Set a file format of the exported excel file to Xlsx to support Microsoft Excel 2007 and newer versions. XlsExport1.FileFormat = GrapeCity.ActiveReports.Export.Excel.Section.FileFormat.Xlsx; XlsExport1.Export(rpt.Document, Application.StartupPath + "\\XLSExpt.xlsx"); |