//while the current column is in row-spanning, act as if
//a vertical merged cell would have been specified.
while (tctx.getNumberOfColumns() > tctx.getColumnIndex()
&& tctx.getColumnRowSpanningNumber().intValue() > 0) {
RtfTableCell vCell = row.newTableCellMergedVertically(
(int)tctx.getColumnWidth(),
tctx.getColumnRowSpanningAttrs());
if (!tctx.getFirstSpanningCol()) {
vCell.setHMerge(RtfTableCell.MERGE_WITH_PREVIOUS);
}
tctx.selectNextColumn();
}
//get the width of the currently started cell
float width = tctx.getColumnWidth();
// create an RtfTableCell in the current RtfTableRow
RtfAttributes atts = TableAttributesConverter.convertCellAttributes(tc);
RtfTableCell cell = row.newTableCell((int)width, atts);
//process number-rows-spanned attribute
if (numberRowsSpanned > 1) {
// Start vertical merge
cell.setVMerge(RtfTableCell.MERGE_START);
// set the number of rows spanned
tctx.setCurrentColumnRowSpanning(new Integer(numberRowsSpanned),
cell.getRtfAttributes());
} else {
tctx.setCurrentColumnRowSpanning(
new Integer(numberRowsSpanned), null);
}
//process number-columns-spanned attribute
if (numberColumnsSpanned > 0) {
// Get the number of columns spanned
tctx.setCurrentFirstSpanningCol(true);
// We widthdraw one cell because the first cell is already created
// (it's the current cell) !
for (int i = 0; i < numberColumnsSpanned - 1; ++i) {
tctx.selectNextColumn();
//aggregate width for further elements
width += tctx.getColumnWidth();
tctx.setCurrentFirstSpanningCol(false);
RtfTableCell hCell = row.newTableCellMergedHorizontally(
0, null);
if (numberRowsSpanned > 1) {
// Start vertical merge
hCell.setVMerge(RtfTableCell.MERGE_START);
// set the number of rows spanned
tctx.setCurrentColumnRowSpanning(
new Integer(numberRowsSpanned),
cell.getRtfAttributes());