Articles in this section
Category / Section

How to change default export format type of report

1 min read

Syncfusion Report Writer allows you to change the default file format to any other file format while exporting the document to Microsoft Word and Microsoft Excel. The following code snippet is used to initialize an RDLC report to the Report Writer.

string reportPath = @"../../ReportTemplate/Product Catalog.rdlc";
string fileName = null;
WriterFormat format;
ReportDataSourceCollection dataSources = new ReportDataSourceCollection();
dataSources.Add(new ReportDataSource { Name = "ProductCatalog", Value = ProductCatalogSource.GetData() });
ReportWriter reportWriter = new ReportWriter(reportPath, dataSources);

 

The following code snippet illustrates how to change the default file format of exported document.

Word

fileName = "ProductCatalog.docx";
format = WriterFormat.Word;
reportWriter.WordOptions = new WordOptions();
reportWriter.WordOptions.FormatType = WordFormatType.Docx;

 

Excel

fileName = "ProductCatalog.xlsx";
format = WriterFormat.Excel;
reportWriter.ExcelOptions = new ExcelOptions();
reportWriter.ExcelOptions.ExcelSaveType = ExcelVersion.Excel2013; 

 

Download file format changing sample

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied