This article demonstrates how to convert an Excel chart to image using Spire.XLS for Java.
The example Excel file:
import com.spire.xls.Workbook; import javax.imageio.ImageIO; import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; public class ChartToImage { public static void main(String[] args) throws IOException { Workbook workbook = new Workbook(); //Load the Excel file workbook.loadFromFile("Chart.xlsx"); //Save the first chart in the first worksheet as image BufferedImage image= workbook.saveChartAsImage(workbook.getWorksheets().get(0), 0); ImageIO.write(image,"png", new File("ChartToImage.png")); } }
Output: