{
xmlWriter.writeTag(LAYOUT_OUTPUT_NAMESPACE, "row", XmlWriter.OPEN);
for (short col = 0; col < columnCount; 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)
{
xmlWriter.writeTag(LAYOUT_OUTPUT_NAMESPACE, "empty-cell", XmlWriter.CLOSE);
continue;
}
// A empty cell with a defined background ..
xmlWriter.writeTag(LAYOUT_OUTPUT_NAMESPACE, "empty-cell", createCellAttributes(background), XmlWriter.CLOSE);
continue;
}
if (content.isCommited() == false)
{
throw new InvalidReportStateException("Uncommited content encountered");
}
final TableRectangle rectangle = sheetLayout.getTableBounds
(content.getX(), content.getY(), content.getWidth(), content.getHeight(), null);
if (rectangle.isOrigin(col, row) == false)
{
// A spanned cell ..
xmlWriter.writeTag(LAYOUT_OUTPUT_NAMESPACE, "spanned-cell", XmlWriter.CLOSE);
continue;
}
final CellBackground realBackground = cellBackgroundProducer.getBackgroundAt
(logicalPage, sheetLayout, rectangle.getX1(), rectangle.getY1(),
rectangle.getColumnSpan(), rectangle.getRowSpan(), true, sectionType);
final AttributeList attributeList;
if (realBackground != null)
{
attributeList = createCellAttributes(realBackground);
}
else
{
attributeList = new AttributeList();
}
attributeList.setAttribute(LAYOUT_OUTPUT_NAMESPACE, "row-span", String.valueOf(rectangle.getRowSpan()));
attributeList.setAttribute(LAYOUT_OUTPUT_NAMESPACE, "col-span", String.valueOf(rectangle.getColumnSpan()));
attributeList.setAttribute(LAYOUT_OUTPUT_NAMESPACE, "href", (String) content.getStyleSheet().getStyleProperty(
ElementStyleKeys.HREF_TARGET));
attributeList.setAttribute(LAYOUT_OUTPUT_NAMESPACE, "href-window",
(String) content.getStyleSheet().getStyleProperty(ElementStyleKeys.HREF_WINDOW));
attributeList.setAttribute(LAYOUT_OUTPUT_NAMESPACE, "href-title",
(String) content.getStyleSheet().getStyleProperty(ElementStyleKeys.HREF_TITLE));
// export the cell and all content ..
xmlWriter.writeTag(LAYOUT_OUTPUT_NAMESPACE, "cell", attributeList, XmlWriter.OPEN);
processBoxChilds(content);
xmlWriter.writeCloseTag();
content.setFinished(true);
}
xmlWriter.writeCloseTag();
}
xmlWriter.writeCloseTag();
}