How to Convert Charts in Excel Files to Image Files inside Java Apps

This technical tip show how java developers can Convert Charts in Excel Files to Image Files using Aspose.Cells for Java. Charts are visually appealing and make it easy for users to see comparisons, patterns, and trends in data.

The following technical tip show how developers can Convert Chart to Image using Aspose.Cells component. Charts are visually appealing and make it easy for users to see comparisons, patterns, and trends in data. For instance, rather than analyzing columns of worksheet numbers, a chart shows at a glance whether sales are falling or rising, or how actual sales compare to projected sales. People are frequently asked to present statistical and graphical information in an easy to understand and an easy to maintain manner. A picture helps. Sometimes, charts are needed in an application or web pages. Or it might be needed needed for a Word document, a PDF file, a PowerPoint presentation or some other application. In each case, you want to render the chart as an image so that you can use it elsewhere. Aspose.Cells for Java has supported converting charts in Excel files to image files since release 2.1.2.

The following example shows how to convert a chart to render an image file.


//Create a new Workbook.
Workbook workbook = new Workbook();

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

//Set the name of worksheet

//Get the cells collection in the sheet.
Cells cells = workbook.getWorksheets().get(0).getCells();

//Put some values into a cells of the Data sheet.

//Create chart
intchartIndex = sheet.getCharts().add(ChartType.COLUMN, 12, 1, 33, 12);
Chart chart = sheet.getCharts().get(chartIndex);

//Set properties of chart title
chart.getTitle().setText("Sales By Region");

//Set properties of nseries
chart.getNSeries().add("Data!B2:B8", true);

//Set the fill colors for the series's data points (France - Portugal(7 points))
ChartPointCollectionchartPoints = chart.getNSeries().get(0).getPoints();

ChartPoint point = chartPoints.get(0);

point = chartPoints.get(1);

point = chartPoints.get(2);

point = chartPoints.get(3);

point = chartPoints.get(4);

point = chartPoints.get(5);

point = chartPoints.get(6);

//Set the legend invisible

//Get the Chart image
ImageOrPrintOptionsimgOpts = new ImageOrPrintOptions();

//Save the chart image file.
chart.toImage(new FileOutputStream("D:\\Files\\MyChartImage.png"), imgOpts);

Overview: Aspose.Pdf for Java

Aspose.Cells is a Java component for spreadsheet reporting without using Microsoft Excel. Other features include creating spreadsheets, opening encrypted excel files, macros, VBA, unicode, formula settings, pivot tables, importing data from JDBC ResultSet and support of CSV, SpreadsheetML, PDF, ODS and all file formats from Excel 97 to Excel 2007. It is compatible with Windows, Linux & Unix and supports all advanced features of data management, formatting, worksheet, charting and graphics.

More about Aspose.Cells for Java

- Homepage of Aspose.Cells for Java:

- Download Aspose.Cells for Java:

- More Technical Tips Using Aspose.Cells for Java:

Contact Details

Company Name: Aspose Pty Ltd
Issued By: Zeeshan Ahmed
Phone: 888.277.6734
Address: Suite 163, 79 Longueville Road
City: Lane Cove
State: NSW
Zip: 2066
Country: Australia
Website: Visit the website

Keywords : Convert Chart to Image, Chart to Image conversion, Create Excel chart, Excel Chart to Image, render chart as an image, converting charts in Excel files, charts in Excel, interactive graphical representation, Aspose.Cells for Java, xlsx files, Named Range, Popup event, Imports a worksheet, selected ranges, Formula Calculation Engine, opening xlsx files in java,

by Zeeshan Ahmed (few years ago!)

Latest Press Releases

The Mad Hatter Now Offer a Full Line of Hearth Products and Full Line of Grills

Diabetes Insulin Delivery Pens Market Research Report 2018

Dr Kapadia Provides Tips to Patients Interested in Hair Transplant Procedures

love vashikaran specialist

Solar Blanket Sales Market Report 2018

Spring Bottled Water Market Insights, Forecast to 2025

Biochemical Incubator Sales Market Report 2018

Quinine Sulphate Sales Market Report 2018

Automotive Chassisc System Market Insights, Forecast to 2025

2,6-Dicarboxypyridine market size in key regions like North America, Europe, Asia Pacific an..

Remove this press release ?

Due to extra work required to remove the press-releases we have started charging $1.99 for press release removal.

Your press release will be removed in 24 hours, once the payment has been received.

Search Press Release
e.g. Business, Computer, etc.