Convert Excel Files to Image in Java

Excel to Image Java

Excel spreadsheets are widely used to store, organize and analyze data. However, you can not embed the Excel workbooks or worksheets directly into your web or desktop applications. One of the suitable options is converting worksheets to image or HTML formats. In this article, you will learn how to convert Excel XLSX/XLS files to PNG, JPEG, BMP, and other image formats using Java.

Java Excel to Image Converter API

In order to convert Excel XLSX or XLS files to image formats, we’ll use Aspose.Cells for Java API. It is a powerful spreadsheet manipulation API that provides high-quality conversion of worksheets into PNG, JPEG, BMP, and other popular image formats. Aspose.Cells for Java can be downloaded as JAR or installed using the following Maven configurations.

<repository>
    <id>AsposeJavaAPI</id>
    <name>Aspose Java API</name>
    <url>https://repository.aspose.com/repo/</url>
</repository>
<dependency>
    <groupId>com.aspose</groupId>
    <artifactId>aspose-cells</artifactId>
    <version>21.2</version>
</dependency>

Aspose.Cells for Java supports conversion of Excel files to the following image formats:

Convert Excel XLSX to Image in Java

The following are the steps along with API references to convert a worksheet into a PNG image.

The following code sample shows how to convert an Excel XLSX file to image using Java.

Excel File

Excel to Image Java

Converted PNG

XLSX to PNG java

Additional Options for Excel to Image Conversion

Aspose.Cells for Java also provides additional options to customize XLSX to image conversion. For example, you can specify the style for gridlines, render one image per sheet, and so on. The ImageOrPrintOptions class is used to set these options. The following code sample shows how to use ImageOrPrintOptions class in Excel to image conversion.

Get a Free License

You can get a free temporary license in order to try the API without evaluation limitations.

Conclusion

In this article, you have learned how to convert Excel files to PNG, JPEG, BMP, or other image formats using Java. Furthermore, you have seen how to customize Excel to image conversion with additional options. You can explore more about Java spreadsheet manipulation API using documentation. In case you would have any questions or queries, contact us via our forum.

See Also