final SheetLayout sheetLayout,
final TableContentProducer tableContentProducer)
{
ColorValueConverter colorValueConverter = new ColorValueConverter();
CellBackgroundProducer cellBackgroundProducer = new CellBackgroundProducer(true, true);
try
{
final XmlWriter writer = new XmlWriter(new OutputStreamWriter(System.out));
writer.writeComment("Table Layout: ");
writer.writeComment("Rows: " + sheetLayout.getRowCount());
writer.writeComment("Columns: " + sheetLayout.getColumnCount());
final int rows = sheetLayout.getRowCount();
final int cols = sheetLayout.getColumnCount();
writer.writeTag(null, "table", XmlWriter.OPEN);
for (int row = 0; row < rows; row++)
{
writer.writeTag(null, "row", XmlWriter.OPEN);
for (int col = 0; col < cols; col++)
{
final int sectionType = tableContentProducer.getSectionType(row, col);
final CellBackground bg =
cellBackgroundProducer.getBackgroundAt(logicalPage, sheetLayout, col, row, true, sectionType);
if (bg == null)
{
writer.writeTag(null, "empty-cell", XmlWriter.CLOSE);
continue;
}