Index: RowPainter.java
===================================================================
--- RowPainter.java	(revision 1481841)
+++ RowPainter.java	(working copy)
@@ -27,7 +27,6 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-
 import org.apache.fop.area.Block;
 import org.apache.fop.area.Trait;
 import org.apache.fop.fo.flow.table.ConditionalBorder;
@@ -46,6 +45,7 @@
 import org.apache.fop.layoutmgr.LayoutContext;
 import org.apache.fop.layoutmgr.SpaceResolver;
 import org.apache.fop.layoutmgr.TraitSetter;
+import org.apache.fop.traits.BorderProps;
 
 class RowPainter {
     private static Log log = LogFactory.getLog(RowPainter.class);
@@ -228,7 +228,8 @@
                 // TableContentPosition produced during row delaying may end up alone on a
                 // page. It will not contain the CellPart instances for the cells starting
                 // the next row, so firstCellParts[i] will still be null for those ones.
-                int cellHeight = cellHeights[i];
+            	int rowsSpanned = currentGU.getCell().getNumberRowsSpanned();
+                int cellHeight = rowsSpanned > 1 ? Math.min(cellHeights[i], 18900) * rowsSpanned : cellHeights[i];
                 cellHeight += lastCellParts[i].getConditionalAfterContentLength();
                 cellHeight += lastCellParts[i].getBorderPaddingAfter(lastInPart);
                 int cellOffset = getRowOffset(Math.max(firstCellParts[i].pgu.getRowIndex(),
