Spreadsheet Converter
The Sheetize Spreadsheet Converter for .NET provides functionality to convert spreadsheets between different formats, making it suitable for data transformation, reporting, and integration tasks.
Key Features
Convert Spreadsheet to PDF
Convert spreadsheet files (e.g., XLSX, CSV) to PDF for easy sharing and printing.
Convert Spreadsheet to Other Formats
Convert spreadsheets to formats such as CSV, JSON, or HTML, enabling integration with web applications or data processing workflows.
Detailed Guide
Converting Spreadsheet to PDF
To convert a spreadsheet to PDF:
- Initialize the Converter: Create an instance of
SpreadsheetConverter
. - Set Conversion Options: Use
SpreadsheetToPdfOptions
to configure settings such as page layout, fit options, and watermarking. - Define Input and Output Paths: Set paths for the input spreadsheet and output PDF.
- Execute the Conversion: Call the
Process
method to complete the conversion.
Example: Convert XLSX to PDF
// Step 1: Initialize the Spreadsheet Converter
var converter = new SpreadsheetConverter();
// Step 2: Configure options for spreadsheet to PDF conversion
var options = new SpreadsheetToPdfOptions();
options.PageLayoutOption = PageLayoutOption.Landscape;
options.FitToPage = true; // Ensure the spreadsheet fits to a single page
// Step 3: Set file paths
options.AddInput(new FileDataSource("input.xlsx"));
options.AddOutput(new FileDataSource("output.pdf"));
// Step 4: Run the conversion
converter.Process(options);
Available Options for Spreadsheet to PDF Conversion
- PageLayoutOption: Define the page orientation for the resulting PDF (
Portrait
,Landscape
). - FitToPage: Specify whether to fit the spreadsheet content onto a single page.
Converting Spreadsheet to Other Formats
To convert a spreadsheet into another format (e.g., CSV, HTML):
- Initialize the Converter: Create an instance of
SpreadsheetConverter
. - Configure Conversion Options: Use
SpreadsheetToDocumentOptions
to specify the target format. - Specify Paths: Set input spreadsheet and output file paths.
- Execute the Conversion: Call the
Process
method to generate the output.
Example: Convert XLSX to CSV
// Step 1: Initialize the Spreadsheet Converter
var converter = new SpreadsheetConverter();
// Step 2: Configure options for spreadsheet to CSV conversion
var options = new SpreadsheetToDocumentOptions(DocumentFormat.Csv);
// Step 3: Set file paths
options.AddInput(new FileDataSource("input.xlsx"));
options.AddOutput(new FileDataSource("output.csv"));
// Step 4: Execute the conversion
converter.Process(options);
Additional Options for Spreadsheet to Document Conversion
- DocumentFormat: Define the desired output format (
Csv
,Json
,Html
). - IncludeFormulas: Choose whether to include calculated formulas or only static values in the output.
The Sheetize Spreadsheet Converter is highly versatile, providing support for transforming spreadsheets into various formats to accommodate different needs. Whether you are creating PDF reports from spreadsheets or extracting data for processing, this converter offers a reliable solution for developers.