Page tree
Skip to end of metadata
Go to start of metadata

使用FlexViewer导出

使用FlexViewer控件,您可以预览和导出报表。报表可以导出为多种文件格式:.pdf,.html,.rtf,.docx,.xls,.xlsx,.zip,.tiff,.bmp,.png,.jpg和.gif。以下代码描述了如何使用C1FlexViewer类的Export方法导出FlexReport:

CS
//Load report definition
c1FlexReport1.Load(@"reportFile", "reportName");

//Specify the report shown by the viewer
c1FlexViewer1.DocumentSource = c1FlexReport1;

//Export
c1FlexViewer1.Export();


使用FlexReport导出为PDF

以下代码描述了如何使用PdfFilter类将FlexReport导出为PDF 。同样,您也可以将报表导出为上述其他格式。

CS
//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);


 

  • No labels