MindFusion.Wpf Pack Programmer's Guide
Exporting

Exporting to ODS

To export a workbook to an ODS (OpenDocument Spreadsheet) file, create an instance of the CalcExporter class and call the Export method. The following example illustrates how to do this:

C#  Copy Code

var calcExporter = new CalcExporter();
calcExporter.Export(workbook, @"c:\mysheet.ods");

Visual Basic  Copy Code

Dim calcExporter As New CalcExporter()
calcExporter.Export(workbook, @"c:\mysheet.ods")

Exporting to XLSX

To export a workbook to an XLSX (Office Open XML) file, create an instance of the ExcelExporter class and call the Export method. The following example illustrates how to do this:

C#  Copy Code

var excelExporter = new ExcelExporter();
excelExporter.Export(workbook, @"c:\mysheet.xlsx");

Visual Basic  Copy Code

Dim excelExporter As New ExcelExporter()
excelExporter.Export(workbook, @"c:\mysheet.xlsx")

Exporting to CSV

To export a worksheet to an CSV (comma-separated values) file, create an instance of the CsvExporter class, set the appropriate properties and call the Export method. The Quote and Separator properties can be used to specify the quote and separator characters respectively in the exported file. The CsvExportForm (found in the MindFusion.Spreadsheet.Wpf.StandardForms.dll assembly) can be used to facilitate the export to CSV.

The following example illustrates how to export a worksheet to an CSV file:

C#  Copy Code

var csvExporter = new CsvExporter();
csvExporter.Export(worksheet, @"d:\mysheet.csv");

Visual Basic  Copy Code

Dim csvExporter As New CsvExporter()
csvExporter.Export(worksheet, "d:\mysheet.csv")

Exporting to PDF

To export a worksheet to a PDF file, create an instance of the PdfExporter class, set the appropriate properties and call the Export method. The following example illustrates how to do this:

C#  Copy Code

var pdfExporter = new PdfExporter();
pdfExporter.Export(worksheet, @"d:\mysheet.pdf");

Visual Basic  Copy Code

Dim pdfExporter As New PdfExporter()
pdfExporter.Export(worksheet, "d:\mysheet.pdf")