final String styleName = (String) attrs.getAttribute(OfficeNamespaces.TABLE_NS, OfficeToken.STYLE_NAME);
final OfficeStyle style = deriveStyle(OfficeToken.TABLE_ROW, styleName);
Element tableRowProperties = style.getTableRowProperties();
if (tableRowProperties == null)
{
tableRowProperties = new Section();
tableRowProperties.setNamespace(OfficeNamespaces.STYLE_NS);
tableRowProperties.setType("table-row-properties");
tableRowProperties.setAttribute(OfficeNamespaces.FO_NS, OfficeToken.BACKGROUND_COLOR, tableBackgroundColor);
style.addNode(tableRowProperties);
}
else
{
final Object oldValue = tableRowProperties.getAttribute(OfficeNamespaces.FO_NS, OfficeToken.BACKGROUND_COLOR);
if (oldValue == null || TRANSPARENT.equals(oldValue))
{
tableRowProperties.setAttribute(OfficeNamespaces.FO_NS, OfficeToken.BACKGROUND_COLOR, tableBackgroundColor);
}
}
attrs.setAttribute(OfficeNamespaces.TABLE_NS, OfficeToken.STYLE_NAME, style.getStyleName());
}
}
else if (ReportTargetUtil.isElementOfType(OfficeNamespaces.TABLE_NS, OfficeToken.TABLE_CELL, attrs))
{
columnCounter++;
final String styleName = (String) attrs.getAttribute(OfficeNamespaces.TABLE_NS, OfficeToken.STYLE_NAME);
if (styleName != null)
{
final OfficeStyle cellStyle = getPredefinedStylesCollection().getStyle(OfficeToken.TABLE_CELL, styleName);
if (cellStyle != null)
{
final Section textProperties = (Section) cellStyle.getTextProperties();
if (textProperties != null)
{
for (String i : FOPROPS)
{
textProperties.setAttribute(OfficeNamespaces.FO_NS, i, null);
}
textProperties.setAttribute(OfficeNamespaces.TEXT_NS, "display", null);
for (String i : STYLEPROPS)
{
textProperties.setAttribute(OfficeNamespaces.STYLE_NS, i, null);
}
}
final Section props = (Section) cellStyle.getTableCellProperties();
if (props != null)
{
final Object raw = props.getAttribute(OfficeNamespaces.FO_NS, OfficeToken.BACKGROUND_COLOR);
if (TRANSPARENT.equals(raw))
{
props.setAttribute(OfficeNamespaces.FO_NS, OfficeToken.BACKGROUND_COLOR, null);
// cellStyle.removeNode(props);
}
}
}
attrs.setAttribute(OfficeNamespaces.TABLE_NS, OfficeToken.STYLE_NAME, styleName);