biggtor
biggtor

Reputation: 47

Fill whole sheet with the same color in Excel - Apache POI

I'm looking for a way to set the color of the background of an Excel worksheet using Java's Apache POI

Thanks!

Upvotes: 2

Views: 2224

Answers (2)

swamy
swamy

Reputation: 1210

HSSFCellStyle cellStyle = workBook.createCellStyle();
style.setFillForegroundColor(IndexedColors.GREY_50_PERCENT.getIndex());
style.setFillPattern(CellStyle.SOLID_FOREGROUND);
cell.setCellStyle(style);

Upvotes: 0

Mike
Mike

Reputation: 3311

Try XSSFSheet.setTabColor from the POI Documentation

Edited:

You may need to apply it to each cell / row style.

How to apply background color for the rows in excel sheet using Apache POI?

Another similar example/better explanation here:

excel poi: apply foreground color to blank cells

Upvotes: 1

Related Questions