Hello,
I am trying to copy conditional formatting in one .xlsx worksheet to another
(in a generic way). Here is what I am doing:
<code>
XSSFSheet xssfSheet = (XSSFSheet) sheet;
//source sheet
XSSFSheet newXssfSheet = (XSSFSheet) newSheet;
//target sheet
XSSFSheetConditionalFormatting scf =
xssfSheet.getSheetConditionalFormatting();
XSSFSheetConditionalFormatting nscf =
newXssfSheet.getSheetConditionalFormatting();
for (int idx = 0; idx <
scf.getNumConditionalFormattings(); idx++) {
XSSFConditionalFormatting cf =
scf.getConditionalFormattingAt(idx);
nscf.addConditionalFormatting(cf);
}
</code>
I can see that this gets the conditional formatting sections from original
sheet correctly.
But when I write the new sheet to a file, it makes the excel to ask to
repair the worksheet after opening.
Any advise on this?
--
View this message in context:
http://apache-poi.1045710.n5.nabble.com/Copy-Conditional-formatting-from-one-Worksheet-to-another-tp5728044.html
Sent from the POI - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]