We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Get ChartType always returns 0

Hi There,


Im using ASPOSE SLIDES 15.8.0 for Java. Im trying to merge data in existing charts in a template presentation, however to do this i need to be able to tell what the type of chart is that I have. Looking at the example snippet, you see im able to get the chart, but invoking the getType method always gives me 0, while the example template I attached clearly has a barchart in there (see attached image also.

The question obviously is, how do I retrieve the correct information, otherwise Im unable to call the correct methods upon the datapoints.

Example snippet:

//get and open the template file
Presentation pres = getNewPresentation();

ISlideCollection presslds = pres.getSlides();
for(int i=0; i<presslds.size(); i++){
ISlide slide = presslds.get_Item(i);
IShapeCollection shapes = slide.getShapes();
for (int s=0; s < shapes.size(); s++){
IShape shp = shapes.get_Item(s);
if (shp instanceof IChart){
IChart chart = (IChart)shp;
//Would expect the next line to print the Charttype number as in the ChartType class, but it is always 0.
System.out.println( chart.getType() );
}
}
}

I have attached a new template file that has multiple slides all with a different type of chart. When printing the chart types I get the following values:


Chart Type: 3 (AREA_3_D = 3) | Should be COLUMN_3_D_CLUSTERED = 18
Chart Type: 19 (COLUMN_3_D_STACKED = 19) | Should be LINE = 37
Chart Type: 34 (CYLINDRICAL_COLUMN_3_D = 34) | Should be BAR = 6
Chart Type: 70 (SURFACE_WIREFRAME_3_D = 70) | Should be RADAR = 57

This is really a problem for me, as I really need this information otherwise I cant use the correct methods to add the datapoints.

AAAAARGH!!!


I’m very very sorry for wasting someones time…I just saw my very very very stupid mistake.

I’m using aspose words, cells and slides in my project and was stupidly referring to the ChartType class for Cells. :-S.

My mistake, sorry all.

Hi Bart,



its good to know that things have been resolved on your end and now they are working fine. Please share, if I may be of any further help to you in this regard.



Many Thanks,