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

Free Support Forum - aspose.com

Change column color of existing chart

Hi there… I have an excel file with existing chart with 3 columns, the problem is that i try to change a color column of existing chart by using aspose methods, but it’s not working i have tested all possible method but i cant change the color. can anyone help me?

Sorry this is my code:

public void setConditionalFormat(Workbook workbook){	
	Worksheet worksheet = workbook.getWorksheets().get("Report");
	Chart cumplCementoChart = worksheet.getCharts().get("Chart 2");
	SeriesCollection series = cumplCementoChart.getNSeries();
	//SeriesCollection series = cumplCementoChart.getgetNSeries();
	Series s2 = series.get(0);

	//Color color = new Color();
	Series s1 = series.get(1);
	Iterator it = series.iterator();
		Series s = (Series) it.next();
		Style style = workbook.createStyle();



Thanks for providing us sample code segment and details.

Please try using setForegroundColor method instead of setBackgroundColor in your code. If you still could not accomplish the task, kindly do provide your template file containing the column/bar chart, we will check it soon.

1 Like

thank you for your response Amjad…
I found the solution :slight smile: the problem was that i needed the points of the series and change their color. i leave my code here… it works!!

public void setConditionalFormat(Workbook workbook){
Worksheet worksheet = workbook.getWorksheets().get(“Report”);
Chart cumplCementoChart = worksheet.getCharts().get(“Chart 2”);//get chart
SeriesCollection series = cumplCementoChart.getNSeries();//get Series
Series s2 = series.get(0);//get serie to change

image.png (3.5 KB)


Thanks for your posting and using Aspose.Cells.

It is good to know that you were able to sort out this issue. Let us know if you encounter any other issue, we will be glad to look into it and help you further.