Thursday, 27 February 2020 08:56

Convert Excel to Image in Java

Written by  support iceblue
Rate this item
(0 votes)

This article demonstrates how to convert Excel to Image using Spire.XLS for Java.

Below screenshot shows the input Excel file we used for demonstration:

Convert Excel to Image in Java

import com.spire.xls.*;
import java.io.*;

public class ExcelToImage {
    public static void main(String[] args) throws IOException {
        //Create a workbook instance
        Workbook workbook = new Workbook();
        //Load the Excel file
        workbook.loadFromFile("Chart.xlsx");

        //Get the first worksheet
        Worksheet sheet = workbook.getWorksheets().get(0);

        //Save the sheet to image
        sheet.saveToImage("image.png");
    }
}

The output image file:

Convert Excel to Image in Java

Additional Info

  • tutorial_title:
Last modified on Thursday, 27 February 2020 09:14
More in this category: « Java convert Excel to PDF