Currently MindFusion.Reporting reports support exporting to image, PDF, HTML, and XLSX formats.
Add references to the MindFusion.Reporting.Pdf.dll and MindFusion.Pdf.dll assemblies to your project. Create a PdfExporter instance and call its Export method, passing a reference to the report to be exported and a string specifying the output file name. Margins specifies the page margins for all pages in the document. If you need to set the page size and orientation, use the PageSize, and PageOrientation properties.
The following example shows how to export a report to a PDF file. The example assumes that pdfPath is a variable containing the name of the file to export to and report is a variable identifying the Report to export.
C# Copy Code |
---|
MindFusion.Reporting.Export.PdfExporter pdfExporter = |
Visual Basic Copy Code |
---|
Dim pdfExporter As New MindFusion.Reporting.Export.PdfExporter() |
Add reference to the MindFusion.Reporting.Html.dll assembly to your project. Create an HtmlExporter instance and call one of its Export method overloads.
If there are images in the report, set EmbedImages to true to embed the images in the HTML as text. If this property is set to false, the images will be copied to the directory specified by the ImageFolder property. This property can also specify a directory relative to the output directory of the exported HTML file.
Note |
---|
Not all browsers can handle embedded images. Make sure the target browser supports them when using the EmbedImages property. |
The following example demonstrates the use of the HtmlExporter class. The example assumes that pdfPath is a variable containing the name of the file to export to and report is a variable identifying the Report to export.
C# Copy Code |
---|
MindFusion.Reporting.Export.HtmlExporter htmlExporter = |
Visual Basic Copy Code |
---|
Dim htmlExporter As New MindFusion.Reporting.Export.HtmlExporter() |
The HtmlExporter class provides a second overload of the Export method, which exports the report to a .NET StringBuilder rather than a file. This is useful when you want to embed the report in a custom page, for example, within a scrollable DIV tag.
Exporting to MHTML is similar to exporting to HTML. It is done through the MhtmlExporter class.
The following example demonstrates the use of the ImageExporter class. The example assumes that imagePath is a variable containing the name of the file to export to and report is a variable identifying the Report to export.
C# Copy Code |
---|
MindFusion.Reporting.Export.ImageExporter imageExporter = |
VB.NET Copy Code |
---|
Dim imageExporter As New MindFusion.Reporting.Export.ImageExporter() |
Add references to the MindFusion.Reporting.Excel.dll and MindFusion.Excel.dll assemblies to your project. Create an ExcelExporter instance and call its Export method, passing a reference to the report to be exported and a string specifying the output file name. Margins specifies the page margins for all pages in the document. If you need to set the page size and orientation, use the PageSize, and PageOrientation properties.
The following example shows how to export a report to an XLSX file. The example assumes that xlsxPath is a variable containing the name of the file to export to and report is a variable identifying the Report to export.
C# Copy Code |
---|
MindFusion.Reporting.Export.ExcelExporter excelExporter = |
VB.NET Copy Code |
---|
Dim excelExporter As New MindFusion.Reporting.Export.ExcelExporter() |