Hi guys,
     I can't get Conditional formatting to work when copying the format
from an existing sheet.

SheetConditionalFormatting sheetConditionalFormattingSheet = s.
getSheetConditionalFormatting();

 SheetConditionalFormatting templateConditionalFormattingSheet =
templateSheet.getSheetConditionalFormatting();

 sheetConditionalFormattingSheet.addConditionalFormatting(
templateConditionalFormattingSheet.getConditionalFormattingAt(0));


that didn't work, so I started to copy the format myself and I found out
that when I was trying to set the colors if I hardcode to some color it
works, but when I use this:

newPatternFormatting.setFillBackgroundColor(oldpatternFormatting.
getFillBackgroundColor());

It doesn't (it will always set the backgroundColor to 0 which is black)


When debugging I see that XSSFPatternFormatting reads the right color (red)
butn then getIndexed returns a 0. So I'm thinking that it might be the
index on the template file and it's different from the one in the file I'm
trying to write maybe?


I couldn't find in the API where to get the RGB color and set it in that
way, or a way to copy the palettes from one to the other.


[image: Inline image 1]


Any idea of what could be causing this?

thanks!

Reply via email to