Free Support Forum -

How to create patterns in a cell background


How to create patterns in a cell background of excel sheet 2003 and excel 2007 format?

I have attached the pattern, which we want to use for a cell.

Please provide us with some sample examples.


Hi,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Please see the following sample code to set the cell background pattern as per your requirement.

//Create Workbook Object

Workbook wb = new Workbook();

//Open first Worksheet in the workbook

Worksheet ws = wb.getWorksheets().getSheet(0);

//Get Worksheet Cells Collection

Cells cell = ws.getCells();

//Get Cell's Style

Style style = cell.getCell(0, 0).getStyle();




//Set Cell's Style

cell.getCell(0, 0).setStyle(style);

//Save Excel File"D:\\cell_style.xls");

Please check the following documentation link for further details regarding background styles and patterns.

Thank You & Best Regards,