private void applyConditionalFormattingToCopiedRows(XSSFSheet sheet, int startRow) {
   final int lastRow = sheet.getLastRowNum();
   XSSFSheetConditionalFormatting formatting = sheet.getSheetConditionalFormatting();
   // Go from end to start because we will be removing them
   for (int i = formatting.getNumConditionalFormattings() - 1; i >= 0; i--) {
     // Get conditional formatting
     XSSFConditionalFormatting format = formatting.getConditionalFormattingAt(i);
     // Apply conditional formatting to new range
     CellRangeAddress[] ranges =
         computeNewFormattingRanges(format.getFormattingRanges(), startRow, lastRow);
     applyRulesToRanges(formatting, format, ranges);
     // remove previous version of the conditional formatting
     formatting.removeConditionalFormatting(i);
   }
 }
Пример #2
0
 public SheetConditionalFormatting getSheetConditionalFormatting() {
   return _sh.getSheetConditionalFormatting();
 }