final boolean incremental)
throws ContentProcessingException
{
try
{
final SheetLayout sheetLayout = contentProducer.getSheetLayout();
final int startRow = contentProducer.getFinishedRows();
final int finishRow = contentProducer.getFilledRows();
if (incremental && startRow == finishRow)
{
return;
}
DefaultHtmlContentGenerator contentGenerator = getContentGenerator();
XmlWriter xmlWriter;
if (documentContentItem == null)
{
this.cellBackgroundProducer = new CellBackgroundProducer
(metaData.isFeatureSupported(AbstractTableOutputProcessor.TREAT_ELLIPSE_AS_RECTANGLE),
metaData.isFeatureSupported(OutputProcessorFeature.UNALIGNED_PAGEBANDS));
initialize(metaData.getConfiguration());
documentContentItem = contentLocation.createItem(contentNameGenerator.generateName(null, "text/html"));
this.writer = createWriterService(documentContentItem.getOutputStream());
xmlWriter = writer.getXmlWriter();
openSheet(logicalPage.getAttributes(), contentProducer.getSheetName(), metaData, sheetLayout, xmlWriter);
}
else
{
xmlWriter = writer.getXmlWriter();
}
final int colCount = sheetLayout.getColumnCount();
final boolean emptyCellsUseCSS = getTagHelper().isEmptyCellsUseCSS();
StyleBuilder styleBuilder = getStyleBuilder();
DefaultStyleBuilderFactory styleBuilderFactory = getStyleBuilderFactory();
if (textExtractor == null)
{
textExtractor = new HtmlTextExtractor(metaData, xmlWriter, contentGenerator, getTagHelper());
}
for (int row = startRow; row < finishRow; row++)
{
final int rowHeight = (int) StrictGeomUtility.toExternalValue(sheetLayout.getRowHeight(row));
final HtmlRowBackgroundStruct struct = getCommonBackground(logicalPage, sheetLayout, row, contentProducer);
xmlWriter.writeTag(HtmlPrinter.XHTML_NAMESPACE, "tr",
getTagHelper().createRowAttributes(rowHeight, struct), XmlWriterSupport.OPEN);
for (int col = 0; col < colCount; col++)
{
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,