5
votes

I'm running a FO file through FOP, and getting an error message below:

WARNING: The following feature isn't implemented by Apache FOP, yet: table-layou
t="auto" (on fo:table) (See position 2:753)
May 22, 2014 11:50:00 AM org.apache.fop.cli.Main startFOP
SEVERE: Exception
org.apache.fop.apps.FOPException: org.apache.fop.fo.ValidationException: The col
umn-number or number of cells in the row overflows the number of fo:table-column
s specified for the table. (See position 2:914)
javax.xml.transform.TransformerException: org.apache.fop.fo.ValidationException:
 The column-number or number of cells in the row overflows the number of fo:tabl
e-columns specified for the table. (See position 2:914)
        at org.apache.fop.cli.InputHandler.transformTo(InputHandler.java:303)
        at org.apache.fop.cli.InputHandler.renderTo(InputHandler.java:130)
        at org.apache.fop.cli.Main.startFOP(Main.java:177)
        at org.apache.fop.cli.Main.main(Main.java:208)
Caused by: javax.xml.transform.TransformerException: org.apache.fop.fo.Validatio
nException: The column-number or number of cells in the row overflows the number
 of fo:table-columns specified for the table. (See position 2:914)
        at org.apache.xalan.transformer.TransformerIdentityImpl.transform(Transf
ormerIdentityImpl.java:501)
        at org.apache.fop.cli.InputHandler.transformTo(InputHandler.java:300)
        ... 3 more
Caused by: org.apache.fop.fo.ValidationException: The column-number or number of
 cells in the row overflows the number of fo:table-columns specified for the tab
le. (See position 2:914)
        at org.apache.fop.events.ValidationExceptionFactory.createException(Vali
dationExceptionFactory.java:38)
        at org.apache.fop.events.EventExceptionManager.throwException(EventExcep
tionManager.java:58)
        at org.apache.fop.events.DefaultEventBroadcaster$1.invoke(DefaultEventBr
oadcaster.java:175)
        at com.sun.proxy.$Proxy2.tooManyCells(Unknown Source)
        at org.apache.fop.fo.flow.table.TableCellContainer.addTableCellChild(Tab
leCellContainer.java:75)
        at org.apache.fop.fo.flow.table.TableRow.addChildNode(TableRow.java:95)
        at org.apache.fop.fo.FOTreeBuilder$MainFOHandler.startElement(FOTreeBuil
der.java:313)
        at org.apache.fop.fo.FOTreeBuilder.startElement(FOTreeBuilder.java:175)
        at org.apache.xalan.transformer.TransformerIdentityImpl.startElement(Tra
nsformerIdentityImpl.java:1072)
        at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Sour
ce)
        at org.apache.xerces.xinclude.XIncludeHandler.startElement(Unknown Sourc
e)
        at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unkn
own Source)
        at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContent
Dispatcher.dispatch(Unknown Source)
        at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Un
known Source)
        at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
        at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
        at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
        at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
        at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Sour
ce)
        at org.apache.xalan.transformer.TransformerIdentityImpl.transform(Transf
ormerIdentityImpl.java:484)
        ... 4 more

The FO file is created with docx4j, which creates doc files, and allows them to be saved to FO and PDF. Not sure if this is relevant, since when I process the FO file through FOP command line I still receive the error. This led me to believe that something is wrong with the setup of the FO table that I am using.

The FO code is as follows:

<root xmlns="http://www.w3.org/1999/XSL/Format">
    <layout-master-set>
        <simple-page-master margin-bottom="0.5in" margin-left="1in" margin-right="1in" margin-top="0.5in" master-name="s1-simple" page-height="11in" page-width="8.5in">
            <region-body margin-bottom="36.0pt" margin-left="0mm" margin-right="0mm" margin-top="36.0pt"/>
            <region-before extent="0.0pt" region-name="xsl-region-before-simple"/>
            <region-after extent="0.0pt" region-name="xsl-region-after-simple"/>
        </simple-page-master>
        <page-sequence-master master-name="s1">
            <repeatable-page-master-alternatives>
                <conditional-page-master-reference master-reference="s1-simple"/>
            </repeatable-page-master-alternatives>
        </page-sequence-master>
    </layout-master-set>
    <page-sequence id="section_s1" master-reference="s1">
        <flow flow-name="xsl-region-body">
            <block break-before="auto" color="#365F91" font-size="14.0pt" font-weight="bold" keep-with-next="always" line-height="115%" space-after="4mm" space-before="0.33in">
                <inline>
                    <inline font-family="Calibri">C.1. Year</inline>
                </inline>
            </block>
            <block font-size="11.0pt" line-height="115%" space-after="4mm">
                <inline>
                    <inline font-family="Calibri">Folder: Concepts</inline>
                </inline>
                <block line-height="0pt" linefeed-treatment="preserve" white-space-treatment="preserve">
                </block>
                <inline>
                    <inline font-family="Calibri">Description: Financial Code</inline>
                </inline>
            </block>
            <block color="#4F81BD" font-size="13.0pt" font-weight="bold" keep-with-next="always" line-height="115%" space-after="4mm" space-before="4mm">
                <inline>
                    <inline font-family="Calibri">Definition</inline>
                </inline>
                <fo:table xmlns:fo="http://www.w3.org/1999/XSL/Format" border-bottom-color="#000000" border-bottom-style="solid" border-bottom-width="0.5pt" border-collapse="collapse" border-left-color="#000000" border-left-style="solid" border-left-width="0.5pt" border-right-color="#000000" border-right-style="solid" border-right-width="0.5pt" border-top-color="#000000" border-top-style="solid" border-top-width="0.5pt" display-align="before" width="0.06in">
                    <fo:table-column column-number="1" column-width="0.02in"/>
                    <fo:table-column column-number="2" column-width="1mm"/>
                    <fo:table-body start-indent="0in">
                        <fo:table-row>
                            <fo:table-cell border-bottom-color="#000000" border-bottom-style="solid" border-bottom-width="0.5pt" border-left-color="#000000" border-left-style="solid" border-left-width="0.5pt" border-right-color="#000000" border-right-style="solid" border-right-width="0.5pt" border-top-color="#000000" border-top-style="solid" border-top-width="0.5pt">
                                <block font-size="11.0pt" line-height="115%" space-after="4mm">
                                    <inline>
                                        <inline font-family="Calibri">Name</inline>
                                    </inline>
                                </block>
                            </fo:table-cell>
                            <fo:table-cell border-bottom-color="#000000" border-bottom-style="solid" border-bottom-width="0.5pt" border-left-color="#000000" border-left-style="solid" border-left-width="0.5pt" border-right-color="#000000" border-right-style="solid" border-right-width="0.5pt" border-top-color="#000000" border-top-style="solid" border-top-width="0.5pt" number-columns-spanned="2">
                                <block font-size="11.0pt" line-height="115%" space-after="4mm">
                                    <inline>
                                        <inline font-family="Calibri">ID</inline>
                                    </inline>
                                </block>
                            </fo:table-cell>
                        </fo:table-row>
                        <fo:table-row>
                            <fo:table-cell border-bottom-color="#000000" border-bottom-style="solid" border-bottom-width="0.5pt" border-left-color="#000000" border-left-style="solid" border-left-width="0.5pt" border-right-color="#000000" border-right-style="solid" border-right-width="0.5pt" border-top-color="#000000" border-top-style="solid" border-top-width="0.5pt">
                                <block font-size="11.0pt" line-height="115%" space-after="4mm">
                                    <inline>
                                        <inline font-family="Calibri">Form Type</inline>
                                    </inline>
                                </block>
                            </fo:table-cell>
                            <fo:table-cell border-bottom-color="#000000" border-bottom-style="solid" border-bottom-width="0.5pt" border-left-color="#000000" border-left-style="solid" border-left-width="0.5pt" border-right-color="#000000" border-right-style="solid" border-right-width="0.5pt" border-top-color="#000000" border-top-style="solid" border-top-width="0.5pt" number-columns-spanned="2">
                                <block font-size="11.0pt" line-height="115%" space-after="4mm">
                                    <inline>
                                        <inline font-family="Calibri">ID</inline>
                                    </inline>
                                </block>
                            </fo:table-cell>
                        </fo:table-row>
                        <fo:table-row>
                            <fo:table-cell border-bottom-color="#000000" border-bottom-style="solid" border-bottom-width="0.5pt" border-left-color="#000000" border-left-style="solid" border-left-width="0.5pt" border-right-color="#000000" border-right-style="solid" border-right-width="0.5pt" border-top-color="#000000" border-top-style="solid" border-top-width="0.5pt" display-align="before" number-rows-spanned="3">
                                <block font-size="11.0pt" line-height="115%" space-after="4mm">
                                    <inline>
                                        <inline font-family="Calibri">Source System Info</inline>
                                    </inline>
                                </block>
                            </fo:table-cell>
                            <fo:table-cell border-bottom-color="#000000" border-bottom-style="solid" border-bottom-width="0.5pt" border-left-color="#000000" border-left-style="solid" border-left-width="0.5pt" border-right-color="#000000" border-right-style="solid" border-right-width="0.5pt" border-top-color="#000000" border-top-style="solid" border-top-width="0.5pt">
                                <block font-size="11.0pt" line-height="115%" space-after="4mm">
                                    <inline>
                                        <inline font-family="Calibri">Field</inline>
                                    </inline>
                                </block>
                            </fo:table-cell>
                            <fo:table-cell border-bottom-color="#000000" border-bottom-style="solid" border-bottom-width="0.5pt" border-left-color="#000000" border-left-style="solid" border-left-width="0.5pt" border-right-color="#000000" border-right-style="solid" border-right-width="0.5pt" border-top-color="#000000" border-top-style="solid" border-top-width="0.5pt">
                                <block font-size="11.0pt" line-height="115%" space-after="4mm">
                                    <inline>
                                        <inline font-family="Calibri">Field1 </inline>
                                    </inline>
                                </block>
                            </fo:table-cell>
                        </fo:table-row>
                        <fo:table-row>
                            <fo:table-cell border-bottom-color="#000000" border-bottom-style="solid" border-bottom-width="0.5pt" border-left-color="#000000" border-left-style="solid" border-left-width="0.5pt" border-right-color="#000000" border-right-style="solid" border-right-width="0.5pt" border-top-color="#000000" border-top-style="solid" border-top-width="0.5pt">
                                <block font-size="11.0pt" line-height="115%" space-after="4mm">
                                    <inline>
                                        <inline font-family="Calibri">Logic</inline>
                                    </inline>
                                </block>
                            </fo:table-cell>
                            <fo:table-cell border-bottom-color="#000000" border-bottom-style="solid" border-bottom-width="0.5pt" border-left-color="#000000" border-left-style="solid" border-left-width="0.5pt" border-right-color="#000000" border-right-style="solid" border-right-width="0.5pt" border-top-color="#000000" border-top-style="solid" border-top-width="0.5pt">
                                <block font-size="11.0pt" line-height="115%" space-after="4mm">
                                    <inline>
                                        <inline font-family="Calibri">Straight</inline>
                                    </inline>
                                </block>
                            </fo:table-cell>
                        </fo:table-row>
                        <fo:table-row>
                            <fo:table-cell border-bottom-color="#000000" border-bottom-style="solid" border-bottom-width="0.5pt" border-left-color="#000000" border-left-style="solid" border-left-width="0.5pt" border-right-color="#000000" border-right-style="solid" border-right-width="0.5pt" border-top-color="#000000" border-top-style="solid" border-top-width="0.5pt">
                                <block font-size="11.0pt" line-height="115%" space-after="4mm">
                                    <inline>
                                        <inline font-family="Calibri">Sample Data</inline>
                                    </inline>
                                </block>
                            </fo:table-cell>
                            <fo:table-cell border-bottom-color="#000000" border-bottom-style="solid" border-bottom-width="0.5pt" border-left-color="#000000" border-left-style="solid" border-left-width="0.5pt" border-right-color="#000000" border-right-style="solid" border-right-width="0.5pt" border-top-color="#000000" border-top-style="solid" border-top-width="0.5pt">
                                <block font-size="11.0pt" line-height="115%" space-after="4mm">
                                    <inline>
                                        <inline font-family="Calibri">Straight</inline>
                                    </inline>
                                </block>
                            </fo:table-cell>
                        </fo:table-row>
                        <fo:table-row>
                            <fo:table-cell border-bottom-color="#000000" border-bottom-style="solid" border-bottom-width="0.5pt" border-left-color="#000000" border-left-style="solid" border-left-width="0.5pt" border-right-color="#000000" border-right-style="solid" border-right-width="0.5pt" border-top-color="#000000" border-top-style="solid" border-top-width="0.5pt" display-align="before" number-rows-spanned="3">
                                <block font-size="11.0pt" line-height="115%" space-after="4mm">
                                    <inline>
                                        <inline font-family="Calibri">Warehouse Info</inline>
                                    </inline>
                                </block>
                            </fo:table-cell>
                            <fo:table-cell border-bottom-color="#000000" border-bottom-style="solid" border-bottom-width="0.5pt" border-left-color="#000000" border-left-style="solid" border-left-width="0.5pt" border-right-color="#000000" border-right-style="solid" border-right-width="0.5pt" border-top-color="#000000" border-top-style="solid" border-top-width="0.5pt">
                                <block font-size="11.0pt" line-height="115%" space-after="4mm">
                                    <inline>
                                        <inline font-family="Calibri">Field</inline>
                                    </inline>
                                </block>
                            </fo:table-cell>
                            <fo:table-cell border-bottom-color="#000000" border-bottom-style="solid" border-bottom-width="0.5pt" border-left-color="#000000" border-left-style="solid" border-left-width="0.5pt" border-right-color="#000000" border-right-style="solid" border-right-width="0.5pt" border-top-color="#000000" border-top-style="solid" border-top-width="0.5pt">
                                <block font-size="11.0pt" line-height="115%" space-after="4mm">
                                    <inline>
                                        <inline font-family="Calibri">Field2</inline>
                                    </inline>
                                </block>
                            </fo:table-cell>
                        </fo:table-row>
                        <fo:table-row>
                            <fo:table-cell border-bottom-color="#000000" border-bottom-style="solid" border-bottom-width="0.5pt" border-left-color="#000000" border-left-style="solid" border-left-width="0.5pt" border-right-color="#000000" border-right-style="solid" border-right-width="0.5pt" border-top-color="#000000" border-top-style="solid" border-top-width="0.5pt">
                                <block font-size="11.0pt" line-height="115%" space-after="4mm">
                                    <inline>
                                        <inline font-family="Calibri">Logic</inline>
                                    </inline>
                                </block>
                            </fo:table-cell>
                            <fo:table-cell border-bottom-color="#000000" border-bottom-style="solid" border-bottom-width="0.5pt" border-left-color="#000000" border-left-style="solid" border-left-width="0.5pt" border-right-color="#000000" border-right-style="solid" border-right-width="0.5pt" border-top-color="#000000" border-top-style="solid" border-top-width="0.5pt">
                                <block font-size="11.0pt" line-height="115%" space-after="4mm">
                                    <inline>
                                        <inline font-family="Calibri">Straight</inline>
                                    </inline>
                                </block>
                            </fo:table-cell>
                        </fo:table-row>
                        <fo:table-row>
                            <fo:table-cell border-bottom-color="#000000" border-bottom-style="solid" border-bottom-width="0.5pt" border-left-color="#000000" border-left-style="solid" border-left-width="0.5pt" border-right-color="#000000" border-right-style="solid" border-right-width="0.5pt" border-top-color="#000000" border-top-style="solid" border-top-width="0.5pt">
                                <block font-size="11.0pt" line-height="115%" space-after="4mm">
                                    <inline>
                                        <inline font-family="Calibri">Sample Data</inline>
                                    </inline>
                                </block>
                            </fo:table-cell>
                            <fo:table-cell border-bottom-color="#000000" border-bottom-style="solid" border-bottom-width="0.5pt" border-left-color="#000000" border-left-style="solid" border-left-width="0.5pt" border-right-color="#000000" border-right-style="solid" border-right-width="0.5pt" border-top-color="#000000" border-top-style="solid" border-top-width="0.5pt">
                                <block font-size="11.0pt" line-height="115%" space-after="4mm">
                                    <inline>
                                        <inline font-family="Calibri">Straight</inline>
                                    </inline>
                                </block>
                            </fo:table-cell>
                        </fo:table-row>
                    </fo:table-body>
                </fo:table>
            </block>
        </flow>
    </page-sequence>
</root>

The other question I had, is how do I check position?

EDIT: I noticed that there were 3 cells in some table-rows. I changed these by deleting the last table-cell

<fo:table-row>
    <fo:table-cell border-bottom-color="#000000" border-bottom-style="solid" border-bottom-width="0.5pt" border-left-color="#000000" border-left-style="solid" border-left-width="0.5pt" border-right-color="#000000" border-right-style="solid" border-right-width="0.5pt" border-top-color="#000000" border-top-style="solid" border-top-width="0.5pt" display-align="before" number-rows-spanned="3">
        <block font-size="11.0pt" line-height="115%" space-after="4mm">
            <inline>
                <inline font-family="Calibri">Source System Info</inline>
            </inline>
        </block>
    </fo:table-cell>
    <fo:table-cell border-bottom-color="#000000" border-bottom-style="solid" border-bottom-width="0.5pt" border-left-color="#000000" border-left-style="solid" border-left-width="0.5pt" border-right-color="#000000" border-right-style="solid" border-right-width="0.5pt" border-top-color="#000000" border-top-style="solid" border-top-width="0.5pt">
        <block font-size="11.0pt" line-height="115%" space-after="4mm">
            <inline>
                <inline font-family="Calibri">Field</inline>
            </inline>
        </block>
    </fo:table-cell>
    <fo:table-cell border-bottom-color="#000000" border-bottom-style="solid" border-bottom-width="0.5pt" border-left-color="#000000" border-left-style="solid" border-left-width="0.5pt" border-right-color="#000000" border-right-style="solid" border-right-width="0.5pt" border-top-color="#000000" border-top-style="solid" border-top-width="0.5pt">
        <block font-size="11.0pt" line-height="115%" space-after="4mm">
            <inline>
                <inline font-family="Calibri">Field1 </inline>
            </inline>
        </block>
    </fo:table-cell>
</fo:table-row>
1
So, did you answer your question then with the edit? The error message seems to indicate that you specified two columns in the table and had rows with three cells. Is that error now gone with your edit?Kevin Brown
yeah I wasn't sure it was putting the extra cell in the row, then I figured it out.blackpearl

1 Answers

0
votes

The problem is in this line fo:table-column column-number="2" column-width="1mm"/.

Try to change the column-number to 3.