| Working with FlexReport > Exporting Reports to Various Formats |
With FlexViewer control, you can preview the reports as well as export them. The reports can be exported to several file formats: .pdf, .html, .rtf, .docx, .xls, .xlsx, .zip, .tiff, .bmp, .png, .jpg, and .gif. The following code describes how to export a FlexReport using Export method of C1FlexViewer Class:
'Load report definition C1FlexReport1.Load(@"reportFile", "reportName") 'Specify the report shown by the viewer C1FlexViewer1.DocumentSource = C1FlexReport1 'Export C1FlexViewer1.Export()
//Load report definition c1FlexReport1.Load(@"reportFile", "reportName"); //Specify the report shown by the viewer c1FlexViewer1.DocumentSource = c1FlexReport1; //Export c1FlexViewer1.Export();
The following code describes how to export a FlexReport to PDF using PdfFilter class. Similarly, you can also export the report to other formats mentioned above.
'create report object Dim c1FlexReport1 As New C1FlexReport() 'Load a report c1FlexReport1.Load("../../ProductsReport.flxr", "Products Report") c1FlexReport1.Render() 'Create PdfFilter object Dim filter As New C1.Win.C1Document.Export.PdfFilter() filter.ShowOptions = False 'Give file name and path where exported file will be saved filter.FileName = "Products Report" + "../../ProductsReport.pdf" 'The report is exported as ProductsReport.pdf in bin\debug folder 'Export c1FlexReport1.RenderToFilter(filter)
//create report object C1FlexReport c1FlexReport1 = new C1FlexReport(); //Load a report c1FlexReport1.Load(@"..\..\ProductsReport.flxr", "Products Report"); c1FlexReport1.Render(); //Create PdfFilter object C1.Win.C1Document.Export.PdfFilter filter = new C1.Win.C1Document.Export.PdfFilter(); filter.ShowOptions = false; //Give file name and path where exported file will be saved filter.FileName = "Products Report" + @"..\..\ProductsReport.pdf"; //The report is exported as ProductsReport.pdf in bin\debug folder //Export c1FlexReport1.RenderToFilter(filter);