aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/org/apache/fop/fo/flow
diff options
context:
space:
mode:
Diffstat (limited to 'src/java/org/apache/fop/fo/flow')
-rw-r--r--src/java/org/apache/fop/fo/flow/Table.java7
-rw-r--r--src/java/org/apache/fop/fo/flow/TableCellContainer.java7
2 files changed, 14 insertions, 0 deletions
diff --git a/src/java/org/apache/fop/fo/flow/Table.java b/src/java/org/apache/fop/fo/flow/Table.java
index 7bc2d49ec..2dfc06fdf 100644
--- a/src/java/org/apache/fop/fo/flow/Table.java
+++ b/src/java/org/apache/fop/fo/flow/Table.java
@@ -83,6 +83,8 @@ public class Table extends TableFObj implements ColumnNumberManagerHolder {
private boolean tableFooterFound = false;
private boolean tableBodyFound = false;
+ private boolean hasExplicitColumns = false;
+
/**
* The table's property list. Used in case the table has
* no explicit columns, as a parent property list to
@@ -236,6 +238,7 @@ public class Table extends TableFObj implements ColumnNumberManagerHolder {
switch (childId) {
case FO_TABLE_COLUMN:
+ hasExplicitColumns = true;
if (!inMarker()) {
addColumnNode((TableColumn) child);
} else {
@@ -313,6 +316,10 @@ public class Table extends TableFObj implements ColumnNumberManagerHolder {
columnNumberManager.signalUsedColumnNumbers(colNumber, colNumber + colRepeat - 1);
}
+ boolean hasExplicitColumns() {
+ return hasExplicitColumns;
+ }
+
/** @return true of table-layout="auto" */
public boolean isAutoLayout() {
return (tableLayout == EN_AUTO);
diff --git a/src/java/org/apache/fop/fo/flow/TableCellContainer.java b/src/java/org/apache/fop/fo/flow/TableCellContainer.java
index 228e3c80d..348ae93f2 100644
--- a/src/java/org/apache/fop/fo/flow/TableCellContainer.java
+++ b/src/java/org/apache/fop/fo/flow/TableCellContainer.java
@@ -24,6 +24,7 @@ import java.util.List;
import org.apache.fop.apps.FOPException;
import org.apache.fop.datatypes.Length;
import org.apache.fop.fo.FONode;
+import org.apache.fop.fo.ValidationException;
/**
* A common class for fo:table-body and fo:table-row which both can contain fo:table-cell.
@@ -66,6 +67,12 @@ public abstract class TableCellContainer extends TableFObj implements ColumnNumb
int colSpan = cell.getNumberColumnsSpanned();
int rowSpan = cell.getNumberRowsSpanned();
+ Table t = getTable();
+ if (t.hasExplicitColumns() && colNumber + colSpan - 1 > t.getNumberOfColumns()) {
+ throw new ValidationException(FONode.errorText(locator) + "column-number or number "
+ + "of cells in the row overflows the number of fo:table-column specified "
+ + "for the table.");
+ }
if (firstRow) {
handleCellWidth(cell, colNumber, colSpan);
updatePendingSpansSize(cell, colNumber, colSpan);