Hi,
please look at the following code:
workbook.open("Template.xls");
Worksheets worksheets = workbook.getWorksheets();
Worksheet worksheet = worksheets.getSheet(0);
for (Iterator iterator = worksheet.getCells().getCellIterator(); iterator.hasNext();) {
Cell cell = iterator.next();
Style style = cell.getStyle();
style.setCellLocked(false);
cell.setStyle(style);
if (style.getColor().getGreen() != cell.getStyle().getColor().getGreen())
System.out.println(cell.getName() + ": old style: " + style.getColor()
+ " new style: " + cell.getStyle().getColor());
}
workbook.save("Changed color.xls");
and the output:
C4: old style: Color [R=192, G=192, B=192, TINT=0.0, THEME=-1]
new style: Color [R=150, G=150, B=150, TINT=0.0, THEME=-1]
C5: old style: Color [R=192, G=192, B=192, TINT=0.0, THEME=-1]
new style: Color [R=150, G=150, B=150, TINT=0.0, THEME=-1]
C7: old style: Color [R=192, G=192, B=192, TINT=0.0, THEME=-1]
new style: Color [R=150, G=150, B=150, TINT=0.0, THEME=-1]
The colors in "Changed color.xls" after the setting of revised style are now wrong.
What can we do to keep the color?
Thanks,
Inna<span style=“font-family: “Times New Roman”,“serif”;” lang=“EN-US”><o:p></o:p>