Reputation: 1
I'm trying to create a table in word document using Java Apache POI 3.7 and I need to change the cell color of that table. I use XWPFTable but there are no way to change the cell color .Can anybody suggest a hack to do it?
XWPFTable tableVersion = document.createTable();
XWPFTableRow tableOneRowVersion = tableVersion.createRow();
tableOneRowVersion.getCell(0).setText("Version");
Upvotes: 0
Views: 3863
Reputation: 31
Ref : https://poi.apache.org/apidocs/org/apache/poi/xwpf/usermodel/XWPFTableCell.html
For Example:
XWPFTable tableVersion = document.createTable();
XWPFTableRow tableOneRowVersion = tableVersion.createRow();
tableOneRowVersion.getCell(0).setColor("000000");
tableOneRowVersion.getCell(0).setText("Version");
Make sure that you set the color in a hexa decimal form...
Upvotes: 3