return colSpan;
}
- protected int getNumberRowsSpanned( Table table, int currentRowIndex,
+ protected int getNumberRowsSpanned( Table table,
+ final int[] tableCellEdges, int currentRowIndex,
int currentColumnIndex, TableCell tableCell )
{
if ( !tableCell.isFirstVerticallyMerged() )
TableRow nextRow = table.getRow( r1 );
if ( currentColumnIndex >= nextRow.numCells() )
break;
+
+ // we need to skip row if he don't have cells at all
+ boolean hasCells = false;
+ int currentEdgeIndex = 0;
+ for ( int c = 0; c < nextRow.numCells(); c++ )
+ {
+ TableCell nextTableCell = nextRow.getCell( c );
+ if ( !nextTableCell.isVerticallyMerged()
+ || nextTableCell.isFirstVerticallyMerged() )
+ {
+ int colSpan = getNumberColumnsSpanned( tableCellEdges,
+ currentEdgeIndex, nextTableCell );
+ currentEdgeIndex += colSpan;
+
+ if ( colSpan != 0 )
+ {
+ hasCells = true;
+ break;
+ }
+ }
+ else
+ {
+ currentEdgeIndex += getNumberColumnsSpanned(
+ tableCellEdges, currentEdgeIndex, nextTableCell );
+ }
+ }
+ if ( !hasCells )
+ continue;
+
TableCell nextCell = nextRow.getCell( currentColumnIndex );
if ( !nextCell.isVerticallyMerged()
|| nextCell.isFirstVerticallyMerged() )
return picturesManager;
}
- protected int getTableCellEdgesIndexSkipCount( Table table, int r,
- int[] tableCellEdges, int currentEdgeIndex, int c,
- TableCell tableCell )
- {
- TableCell upperCell = null;
- for ( int r1 = r - 1; r1 >= 0; r1-- )
- {
- final TableRow row = table.getRow( r1 );
- if ( row == null || c >= row.numCells() )
- continue;
-
- final TableCell prevCell = row.getCell( c );
- if ( prevCell != null && prevCell.isFirstVerticallyMerged() )
- {
- upperCell = prevCell;
- break;
- }
- }
- if ( upperCell == null )
- {
- logger.log( POILogger.WARN, "First vertically merged cell for ",
- tableCell, " not found" );
- return 0;
- }
-
- return getNumberColumnsSpanned( tableCellEdges, currentEdgeIndex,
- tableCell );
- }
-
protected abstract void outputCharacters( Element block,
CharacterRun characterRun, String text );
if ( tableCell.isVerticallyMerged()
&& !tableCell.isFirstVerticallyMerged() )
{
- currentEdgeIndex += getTableCellEdgesIndexSkipCount( table,
- r, tableCellEdges, currentEdgeIndex, c, tableCell );
+ currentEdgeIndex += getNumberColumnsSpanned(
+ tableCellEdges, currentEdgeIndex, tableCell );
continue;
}
tableCellElement.setAttribute( "number-columns-spanned",
String.valueOf( colSpan ) );
- final int rowSpan = getNumberRowsSpanned( table, r, c,
- tableCell );
+ final int rowSpan = getNumberRowsSpanned( table,
+ tableCellEdges, r, c, tableCell );
if ( rowSpan > 1 )
tableCellElement.setAttribute( "number-rows-spanned",
String.valueOf( rowSpan ) );
{
inline.setAttribute( "color", getColor24( characterRun.getIco24() ) );
}
- final int opacity = (int) ( characterRun.getIco24() & 0xFF000000l ) >>> 24;
- if ( opacity != 0 && opacity != 0xFF )
- {
- inline.setAttribute( "opacity",
- getOpacity( characterRun.getIco24() ) );
- }
+ /* XLS FO 1.1 doesn't support opacity -- sergey */
+ // final int opacity = (int) ( characterRun.getIco24() & 0xFF000000l )
+ // >>> 24;
+ // if ( opacity != 0 && opacity != 0xFF )
+ // {
+ // inline.setAttribute( "opacity",
+ // getOpacity( characterRun.getIco24() ) );
+ // }
if ( characterRun.isCapitalized() )
{
inline.setAttribute( "text-transform", "uppercase" );
if ( tableCell.isVerticallyMerged()
&& !tableCell.isFirstVerticallyMerged() )
{
- currentEdgeIndex += getTableCellEdgesIndexSkipCount( table,
- r, tableCellEdges, currentEdgeIndex, c, tableCell );
+ currentEdgeIndex += getNumberColumnsSpanned(
+ tableCellEdges, currentEdgeIndex, tableCell );
continue;
}
tableCellElement.setAttribute( "colspan",
String.valueOf( colSpan ) );
- final int rowSpan = getNumberRowsSpanned( table, r, c,
- tableCell );
+ final int rowSpan = getNumberRowsSpanned( table,
+ tableCellEdges, r, c, tableCell );
if ( rowSpan > 1 )
tableCellElement.setAttribute( "rowspan",
String.valueOf( rowSpan ) );