final RenderBox content = contentProducer.getContent(row, col);
final CellMarker.SectionType sectionType = contentProducer.getSectionType(row, col);
if (content == null)
{
final RenderBox backgroundBox = contentProducer.getBackground(row, col);
final CellBackground background;
if (backgroundBox != null)
{
background = cellBackgroundProducer.getBackgroundForBox
(logicalPage, sheetLayout, col, row, 1, 1, true, sectionType, backgroundBox);
}
else
{
background = cellBackgroundProducer.getBackgroundAt(logicalPage, sheetLayout, col, row, true, sectionType);
}
writeBackgroundCell(background, xmlWriter);
continue;
}
if (content.isCommited() == false)
{
throw new InvalidReportStateException(
"Uncommited content encountered: " + row + ", " + col + ' ' + content);
}
final long contentOffset = contentProducer.getContentOffset(row, col);
final long colPos = sheetLayout.getXPosition(col);
final long rowPos = sheetLayout.getYPosition(row);
if (content.getX() != colPos || (content.getY() + contentOffset) != rowPos)
{
// A spanned cell ..
if (content.isFinishedTable())
{
continue;
}
}
final int colSpan = sheetLayout.getColSpan(col, content.getX() + content.getWidth());
final int rowSpan = sheetLayout.getRowSpan(row, content.getY() + content.getHeight() + contentOffset);
final CellBackground realBackground = cellBackgroundProducer.getBackgroundForBox
(logicalPage, sheetLayout, col, row, colSpan, rowSpan, true, sectionType, content);
final StyleBuilder cellStyle = styleBuilderFactory.createCellStyle(styleBuilder,
content.getStyleSheet(), content.getBoxDefinition(), realBackground, null, null);
final AttributeList cellAttributes = getTagHelper().createCellAttributes
(colSpan, rowSpan, content.getAttributes(), content.getStyleSheet(), realBackground, cellStyle);
xmlWriter.writeTag(HtmlPrinter.XHTML_NAMESPACE, "td", cellAttributes, XmlWriterSupport.OPEN);
final Object rawContent = content.getAttributes().getAttribute(AttributeNames.Html.NAMESPACE,
AttributeNames.Html.EXTRA_RAW_CONTENT);
if (rawContent != null)
{
xmlWriter.writeText(String.valueOf(rawContent));
}
if (realBackground != null)
{
final String[] anchors = realBackground.getAnchors();
for (int i = 0; i < anchors.length; i++)
{
final String anchor = anchors[i];
xmlWriter.writeTag(HtmlPrinter.XHTML_NAMESPACE, "a", "name", anchor, XmlWriterSupport.CLOSE);
}