https://bz.apache.org/bugzilla/show_bug.cgi?id=56774

Bhaskar Edara <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|NEEDINFO                    |RESOLVED

--- Comment #3 from Bhaskar Edara <[email protected]> ---
I am able to verify this works using build poi-bin-3.13-beta1-20150720. Test
code I have used

import java.io.FileOutputStream;

import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.ConditionalFormattingRule;
import org.apache.poi.ss.usermodel.PatternFormatting;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.SheetConditionalFormatting;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.ss.util.CellRangeAddress;
import org.apache.poi.xssf.usermodel.XSSFColor;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;

public class TestColor {

    public static void main(String[] args) throws Exception{
        Workbook wb = new XSSFWorkbook();
        Sheet s = wb.createSheet("TestColor");
        s.setColumnWidth(0, 20*256);
        s.setColumnWidth(1, 20*256);
        for (int i = 0; i < 5; i++) {
            Row r = s.createRow(i);
            Cell c1 = r.createCell(0);
            c1.setCellValue(i);
            Cell c2 = r.createCell(1);
            c2.setCellValue(i+1);
        }
        SheetConditionalFormatting sheetCF = s.getSheetConditionalFormatting();
        ConditionalFormattingRule cfRule = 
sheetCF.createConditionalFormattingRule("MOD(ROW(),2)=1");
        PatternFormatting pfmt = cfRule.createPatternFormatting();
        pfmt.setFillBackgroundColor(new XSSFColor(new java.awt.Color(98, 239,
216)));
        CellRangeAddress[] region = {CellRangeAddress.valueOf("A1:B5")};
        sheetCF.addConditionalFormatting(region, cfRule);
        wb.write(new FileOutputStream("C:/poi-test/test.xlsx"));

        wb.close();
    }

}

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to