Free Support Forum - aspose.com

Aspose Slides Java - Parsing excel data and pasting onto a table/graph/chart

Hello,

A bit new to Aspose Slides. I’m trying to parse excel data and then create a table/graph/chart from scratch onto a slide and input the parsed data. Is this possible? This differs from OLE as we want the actual tables and data to be on the slides and editable.

@chehe,

The mechanism of charts and tables are different in Aspose.Slides API as compared to one in Aspose.Cells. Therefore, you need to traverse the Excel file using Aspose.Cells and then add the respective table or chart data from scratch using Aspose.Slides. Please visit working with tables and working with charts documentation sections for more information about handling them using Aspose.Slides.

@mudassir.fayyaz,

Thank you for your response. I was able to figure out the tables case. As for the charts/graphs case, can I use cells to check the types of graphs/charts in an excel file? If so could you provide some sample code. Otherwise I wouldn’t know exactly what type of graph/chart to create in slides without this feature.

@chehe,

Aspose.Slides supports these MSO chart types.You can visit this documentation link for different working samples for the chart.

@mudassir.fayyaz

I’m actually asking whether there is a functionality to check if an excel file contains a chart or a graph? If it does I’d like to parse the data.

@chehe,

You may use ChartCollection.getCount() attribute using Aspose.Cells for the sheet. if it is >=1 then the workbook has chart(s).

Workbook workbook = new Workbook("Book1.xlsx");
//Get the first worksheet
Worksheet ws = workbook.getWorksheets().get(0);

int i = ws.getCharts().getCount();

This way, you can iterate through each worksheet and check if it has charts or not .

@mudassir.fayyaz

Thank you. Does that functionality also tells the type of chart/graph in the sheet? e.g pie chart, bar chart, etc.

@chehe,

Please visit this documentation link for your kind reference.