Quick Start Guide | |
---|---|
What You Will Need |
Visual Studio 2022 |
Controls Referenced | |
Tutorial Concept | This tutorial demonstrates all the exporting capabilities of the DsExcel API including exporting Excel XLSX to formats such as PDF, Image, JSON, and HTML. |
Exporting reports in different formats guarantees optimal accessibility and seamless integration.
In today's data-driven world, exporting reports in various formats is crucial for analyses and high-quality presentations. Having data available in multiple formats enhances user experience and allows for meaningful insights. With our Document Solutions for Excel (DsExcel) API, you can easily create advanced reports programmatically. DsExcel supports features like data analysis, charting, and exporting to various formats, making it a powerful tool for automating Excel-related tasks.
In this blog, we'll explore how to programmatically export Excel reports to multiple formats using the DsExcel API. Below is a list of the file formats supported by DsExcel API:
Ready to get started? Download Document Solutions for Excel, .NET Edition Today!
Export to Excel
Exporting reports in Excel allows for dynamic data manipulation and analysis, making it ideal for financial reports, data summaries, and interactive dashboards. Excel's features, like formulas and charts, help users make informed decisions by helping them better understand data.
To save the workbook in Excel file format using DsExcel, you can use the Save method with FileFormatEnum set to Xlsx, Xlsm, or Xltx.
Below is the DsExcel code to export the workbook as an Excel file:
Export to PDF
Exporting reports in PDF ensures that content looks the same on any device, making it perfect for sharing and printing. PDFs maintain their layout and design, providing a professional and consistent presentation.
To save the workbook as a PDF using DsExcel, use the Save method with a PdfSaveOptions object as a parameter. This allows you to define various settings such as image quality, border options, shrink settings, security options, and so on.
Below is the code to export a PDF file with multiple settings via DsExcel:
Export to Image
Exporting reports in image format makes sharing and viewing files simple without the need for special software. Images are perfect for quick visual presentations and can be easily added to emails, websites, and other documents.
You can save worksheets, cell ranges, and shapes as images using the ToImage method of DsExcel. To customize settings like background color, resolution, and gridline visibility, use the ImageSaveOptions object as a parameter.
Below is the DsExcel code to export the workbook as an image with different settings:
Export to CSV
Exporting reports in CSV format offers a simple and widely compatible way to share data, making it ideal for database imports and data analysis. CSV files can be easily opened in various applications, making them perfect for quick and efficient data exchange.
You can save a workbook as a CSV file using the Save method. By using the CsvSaveOptions parameter, you can customize settings like the separator string, encoding, and more.
Below is the DsExcel code to export a CSV file with advanced CSV settings:
Export to HTML
Exporting reports in HTML format allows for interactive and web-friendly presentations ideal for online dashboards and web-based reporting. HTML reports can include hyperlinks, images, and dynamic content, making them highly versatile and engaging.
You can save the workbook to an HTML file using the Save method. Using the HtmlSaveOptions parameter, you can apply various settings like sheet name, export area, export gridlines, and so on.
Below is the DsExcel code to export the HTML file with different settings:
Export to JSON
Exporting reports in JSON format provides a structured and lightweight way to exchange data, which is ideal for web applications and APIs. JSON's readable format makes it easy to integrate with various programming languages and tools for seamless data processing.
You can save the workbook to a JSON file using the ToJson method. The saved JSON file can also be directly imported to our JavaScript Spreadsheet widget SpreadJS.
Below is the code to export the workbook to a JSON file:
Export to SJS
Exporting reports in SJS (SpreadJS) format leverages a powerful JavaScript spreadsheet library, enabling interactive data manipulation directly in web applications. This format is perfect for creating user-friendly spreadsheets that can be easily integrated and customized within any web environment.
To save the workbook to SJS file format via DsExcel, you can use the Save method with FileFormatEnum as SJS.
Below is the DsExcel code to export the workbook as an SJS file:
You can check out this sample to implement all the export formats mentioned above.
Conclusion
In this blog, we reviewed how to export Excel reports to various formats using the DsExcel API, making your data more accessible and versatile. Document Solutions for Excel makes it easy to programmatically integrate advanced features like filtering, sorting, conditional formatting, data validation, and more in your generated Excel files.
Ready to try it out? Download Document Solutions for Excel, .NET Edition Today!
If you have any questions about this topic, drop them in the comments below!
More References: