Excel XLS to SVG Java

Excel files are commonly used to keep and organize small as well as large-sized data. Moreover, you can perform various operations on the data stored in Excel worksheets. In certain cases, you may need to convert the Excel files to other formats, for example, to embed their content within the web applications. For such cases, this article covers how to convert Excel XLS and XLSX to SVG in Java.

Java Excel to SVG Converter - Free Download

To convert Excel XLSX or XLS files to SVG, we will use Aspose.Cells for Java. It is a powerful API for creating, modifying, and converting spreadsheet files from within Java applications. You can either download the API or install it using the following Maven configurations.

Repository:

<repository>
    <id>AsposeJavaAPI</id>
    <name>Aspose Java API</name>
    <url>https://repository.aspose.com/repo/</url>
</repository>

Dependency:

<dependency>
    <groupId>com.aspose</groupId>
    <artifactId>aspose-cells</artifactId>
    <version>23.3</version>
</dependency>

How to Convert Excel to SVG in Java

Using Aspose.Cells for Java, you can easily convert an Excel file to SVG within a few steps. This is how you can convert an XLS or XLSX file to SVG.

  • Load the Excel file from the disk.
  • Loop through worksheets or select the desired worksheet.
  • Render sheet(s) as SVG image(s) and save to the desired location.

The following section demonstrates how to convert an Excel file to SVG in Java.

Save Excel XLS as SVG in Java

The following are the steps to convert an Excel file to SVG in Java.

  1. First, load the Excel file using Workbook class.
  2. Then, select the desired worksheet or loop through all the worksheets in WorksheetsCollection.
  3. Create an object of ImageOrPrintOptions class and set rendering options.
  4. Create an object of SheetRenderer class for the worksheet.
  5. Finally, convert Excel sheet(s) to SVG image(s) using SheetRenderer.toImage(int, String) method.

The following Java code sample shows how to save an Excel file to SVG.

Online Excel to SVG Converter

Use our free Excel to SVG converter tool, which is based on Aspose.Cells. No need to create an account or subscribe to anything.

Get Free Java Excel to SVG Converter

Get a free temporary license and convert Excel files to SVG without evaluation limitations.

Java Excel Library - Explore More

You can explore other features of Aspose.Cells for Java using the documentation. Also, you may visit the API references to learn about the classes and methods exposed by the API. In case you would have any questions, ask us via our forum.

Conclusion

In this article, you have learned how to convert Excel XLSX or XLS files to SVG in Java. You can perform this conversion to embed the content of the Excel worksheets into your applications.

See Also