I wanted to create a table with background Red colour and cell in 1x1 position in Yellow colour. After setting the cell shading background colour of 1x0 cell is removed.
Code used
TableStyle tableStyle = (TableStyle)doc.getStyles().add(StyleType.TABLE, "TableStyleTest");
tableStyle.getShading().setBackgroundPatternColor(Color.RED);
builder.startTable();
for (int i = 0; i < 4; i++)
{
for (int j = 0; j < 4; j++)
{
builder.insertCell();
builder.write("Row " + (i + 1) + ", Column " + (j + 1));
}
builder.endRow();
}
Table table = builder.endTable();
table.setStyle(tableStyle);
table.getRows().get(1).getCells().get(1).getCellFormat().getShading().setBackgroundPatternColor(Color.YELLOW);
Find the attachment.