3
votes

I am using Apache FOP for printing my file to PDF. While conversion from FO to PDF I am getting the below error:

Invalid property value encountered in column-number="5": org.apache.fop.fo.expr.PropertyException: fo:table-cell overlaps in column 5. (See position 17071:79)

I am getting this for many rows and columns.

In the pdf the tables are coming properly. Can anyone tell me what is the root cause for this error? When is this error generally thrown?

1

1 Answers

2
votes

This exception is thrown when the value of the column-number property in a fo:table-cell cannot be respected because it conflicts with the number-columns-spanned or number-rows-spanned of previous cells.

Error due to cells spanning columns

Let's look at this simple example showing a table with 3 columns and a row, which generates the same kind of error:

<fo:table>
    <fo:table-column column-number="1"/>
    <fo:table-column column-number="2"/>
    <fo:table-column column-number="3"/>
    <fo:table-body>
        <fo:table-row>
            <fo:table-cell column-number="1">
                <fo:block>a</fo:block>
            </fo:table-cell>
            <fo:table-cell column-number="2" number-columns-spanned="2">
                <fo:block>b</fo:block>
            </fo:table-cell>
            <fo:table-cell column-number="3">
                <fo:block>c</fo:block>
            </fo:table-cell>
        </fo:table-row>
    </fo:table-body>
</fo:table>
  • the first cell is a normal cell
  • the second cell spans two columns, so it occupies both column #2 and #3
  • but then there is another cell, claiming to be in column #3 -> the second and third cells overlap in column 3

Error due to cells spanning rows

A similar situation can happen in presence of cells spanning several rows, conficting with cells in the following lines:

<fo:table>
    <fo:table-column column-number="1"/>
    <fo:table-column column-number="2"/>
    <fo:table-body>
        <fo:table-row>
            <fo:table-cell column-number="1" number-rows-spanned="2">
                <fo:block>A</fo:block>
            </fo:table-cell>
            <fo:table-cell column-number="2">
                <fo:block>B</fo:block>
            </fo:table-cell>
        </fo:table-row>
        <fo:table-row>
            <fo:table-cell column-number="1">
                <fo:block>C</fo:block>
            </fo:table-cell>
            <fo:table-cell column-number="2">
                <fo:block>D</fo:block>
            </fo:table-cell>
        </fo:table-row>
    </fo:table-body>
</fo:table>

Here the conflicting cells are the first one in row #1 and the first one in row #2.

Conclusion

I suggest checking your FO file or the code that creates it (maybe XSLT?) for cells with either number-columns-spanned or number-rows-spanned, and then (where there is a conflict) removing either those properties or the conflicting cells.

In the pdf the tables are coming properly.

This is very strange, as the severity of this exception (at least in FOP 1.1) is FATAL, i.e. the program terminates abnormally.

I think there is a chance that, if indeed a pdf file is created, the incorrect tables have been completely "swallowed" by the error, so that your output could be missing some parts.