{
xmlWriter.writeTag(HtmlPrinter.XHTML_NAMESPACE, "tr",
createRowAttributes(logicalPage, sheetLayout, row, contentProducer), XmlWriterSupport.OPEN);
for (int col = 0; col < colCount; col++)
{
final RenderBox content = contentProducer.getContent(row, col);
final int sectionType = contentProducer.getSectionType(row, col);
if (content == null)
{
final CellBackground background = cellBackgroundProducer.getBackgroundAt
(logicalPage, sheetLayout, col, row, true, sectionType);
if (background == null)
{
if (emptyCellsUseCSS)
{
xmlWriter.writeTag(HtmlPrinter.XHTML_NAMESPACE, "td", XmlWriterSupport.CLOSE);
}
else
{
final AttributeList attrs = new AttributeList();
attrs.setAttribute(HtmlPrinter.XHTML_NAMESPACE, "style", "font-size: 1pt");
xmlWriter.writeTag(HtmlPrinter.XHTML_NAMESPACE, "td", attrs, XmlWriterSupport.OPEN);
xmlWriter.writeText(" ");
xmlWriter.writeCloseTag();
}
continue;
}
// Background cannot be null at this point ..
final String[] anchor = background.getAnchors();
if (anchor.length == 0 && emptyCellsUseCSS)
{
final AttributeList cellAttributes = createCellAttributes(1, 1, null, background, null, null);
xmlWriter.writeTag(HtmlPrinter.XHTML_NAMESPACE, "td", cellAttributes, XmlWriterSupport.CLOSE);
}
else
{
final AttributeList cellAttributes =
createCellAttributes(1, 1, null, background, HtmlPrinter.EMPTY_CELL_ATTRNAMES,
HtmlPrinter.EMPTY_CELL_ATTRVALS);
xmlWriter.writeTag(HtmlPrinter.XHTML_NAMESPACE, "td", cellAttributes, XmlWriterSupport.OPEN);
for (int i = 0; i < anchor.length; i++)
{
xmlWriter.writeTag(HtmlPrinter.XHTML_NAMESPACE, "a", "name", anchor[i], XmlWriterSupport.CLOSE);
}
xmlWriter.writeText(" ");
xmlWriter.writeCloseTag();
}
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.isFinished())
{
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.getBackgroundAt
(logicalPage, sheetLayout, col, row, colSpan, rowSpan, true, sectionType);
final AttributeList cellAttributes = createCellAttributes(colSpan, rowSpan, content, realBackground, null,
null);
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);
}
}
if (Boolean.TRUE.equals(content.getAttributes().getAttribute(AttributeNames.Html.NAMESPACE,
AttributeNames.Html.SURPRESS_CONTENT)) == false)
{
// the style of the content-box itself is already contained in the <td> tag. So there is no need
// to duplicate the style here
if (textExtractor.performOutput(content, true) == false)
{
if (emptyCellsUseCSS == false)
{
xmlWriter.writeText(" ");
}
}
}
final Object rawFooterContent = content.getAttributes().getAttribute(AttributeNames.Html.NAMESPACE,
AttributeNames.Html.EXTRA_RAW_FOOTER_CONTENT);
if (rawFooterContent != null)
{
xmlWriter.writeText(String.valueOf(rawFooterContent));
}
xmlWriter.writeCloseTag();
content.setFinished(true);
}
xmlWriter.writeCloseTag();
}