views:

381

answers:

3

I have a table with three columns in which I'm trying to get some long paragraphs to flow dynamically from the first column into the second and then into the third. Currently, the table will continue on a next page when the first column overflows instead of moving into the second column and so I get several pages filled with only a single column's worth of data. How can I fix this? Here's my code (in which I edited out the specifics), where text1-text8 are the dynamic paragraphs of text:

<fo:table table-layout="fixed" width="100%" border-collapse="collapse">
    <fo:table-column column-width="33.333%" column-number="1"/>
    <fo:table-column column-width="33.333%" column-number="2"/>
    <fo:table-column column-width="33.333%" column-number="3"/>
    <fo:table-body>
        <fo:table-row>
            <fo:table-cell padding="2pt">
                <fo:block>
                    <fo:inline font-weight="bold" font-size="10pt">TEXT</fo:inline>
                </fo:block>
                <fo:block font-weight="bold" font-size="10pt">TEXT</fo:block>
                <fo:block font-weight="bold" font-size="10pt">TEXT</fo:block>
                <fo:block font-weight="bold" font-size="10pt">
                    <xsl:value-of select="@day"/>
                    <xsl:text> </xsl:text>
                    <xsl:value-of select="@month"/>
                    <xsl:text> </xsl:text>
                    <xsl:value-of select="@year"/>
                    <xsl:text> </xsl:text>
                </fo:block>
            </fo:table-cell>
            <fo:table-cell padding="2pt">
                <fo:block text-align="right" font-size="14pt"> *</fo:block>
            </fo:table-cell>
            <fo:table-cell padding="2pt">
                <fo:block>
                    <fo:inline font-weight="bold" font-size="14pt">TEXT</fo:inline>
                    <fo:inline font-weight="bold" font-size="14pt">
                        <xsl:value-of select="@data"/>
                    </fo:inline>
                </fo:block>
                <fo:block>&#x00A0;</fo:block>
                <fo:block>&#x00A0;</fo:block>
                <fo:block>
                    <fo:inline font-weight="bold" font-size="12pt">TEXT</fo:inline>
                    <fo:inline font-weight="bold" font-size="12pt">
                        <xsl:value-of select="@day"/>
                        <xsl:text> </xsl:text>
                        <xsl:value-of select="@month"/>
                        <xsl:text> </xsl:text>
                        <xsl:value-of select="@year"/>
                    </fo:inline>
                </fo:block>
            </fo:table-cell>
        </fo:table-row>

        <fo:table-row height="18px">
            <fo:table-cell padding="2pt">
                <fo:block/>
            </fo:table-cell>
            <fo:table-cell padding="2pt">
                <fo:block/>
            </fo:table-cell>
            <fo:table-cell padding="2pt">
                <fo:block/>
            </fo:table-cell>
        </fo:table-row>

        <fo:table-row>
            <fo:table-cell padding="2pt" number-columns-spanned="3">
                <fo:block text-align="center" font-size="12pt" font-weight="bold">
                    <xsl:value-of select="data"/>
                </fo:block>
            </fo:table-cell>
        </fo:table-row>

        <fo:table-row>
            <fo:table-cell padding="2pt">
                <fo:block/>
            </fo:table-cell>
            <fo:table-cell padding="2pt">
                <fo:block/>
            </fo:table-cell>
            <fo:table-cell padding="2pt">
                <fo:block/>
            </fo:table-cell>
        </fo:table-row>

        <fo:table-row>
            <fo:table-cell padding="2pt" number-columns-spanned="3">
                <fo:block text-align="center" font-size="14pt" font-weight="bold">
                    <xsl:value-of select="moredata"/>
                </fo:block>
            </fo:table-cell>
        </fo:table-row>

        <fo:table-row>
            <fo:table-cell padding="2pt" number-columns-spanned="3">
                <fo:block>
                    <fo:leader leader-pattern="rule" leader-length="100%"/>
                </fo:block>
            </fo:table-cell>
        </fo:table-row>

        <fo:table-row>
            <fo:table-cell padding="2pt">
                <fo:block>
                    <fo:external-graphic content-width="217.429px" scaling="uniform">
                        <xsl:attribute name="src">
                            <xsl:text>url("</xsl:text>
                            <xsl:value-of select="image"/>
                            <xsl:text>.png")</xsl:text>
                        </xsl:attribute>
                    </fo:external-graphic>
                </fo:block>
                <fo:block>
                    <fo:leader leader-pattern="rule" leader-length="100%"/>
                    <fo:inline font-size="10pt" font-weight="bold">TEXT</fo:inline>
                    <fo:inline font-size="10pt" fo:font-weight="normal">
                        <xsl:value-of select="text1"/>
                    </fo:inline>
                </fo:block>
                <fo:block/>
                <fo:block>
                    <fo:inline font-size="10pt" font-weight="bold">TEXT</fo:inline>
                    <fo:inline font-size="10pt">
                        <xsl:value-of select="text2"/>
                    </fo:inline>
                </fo:block>
                <fo:block/>
                <fo:block>
                    <fo:inline font-weight="bold" font-size="10pt">TEXT</fo:inline>
                    <fo:inline font-size="10pt">
                        <xsl:value-of select="text3"/>
                    </fo:inline>
                </fo:block>
                <fo:block>
                    <fo:inline font-size="10pt" font-weight="bold">TEXT</fo:inline>
                    <fo:inline font-size="10pt">
                        <xsl:value-of select="text4"/>
                    </fo:inline>
                </fo:block>
                <fo:block>
                    <fo:inline font-size="10pt" font-weight="bold">TEXT</fo:inline>
                    <fo:inline font-size="10pt">
                        <xsl:value-of select="text5"/>
                    </fo:inline>
                </fo:block>
                <fo:block>&#x00A0;</fo:block>
                <fo:block>
                    <fo:inline font-size="10pt" font-weight="bold">TEXT</fo:inline>
                    <fo:inline font-size="10pt">
                        <xsl:value-of select="text6"/>
                    </fo:inline>
                </fo:block>
                <fo:block>&#x00A0;</fo:block>
                <fo:block>
                    <fo:inline font-size="10pt" font-weight="bold">TEXT</fo:inline>
                    <fo:inline font-size="10pt">
                        <xsl:value-of select="text7"/>
                    </fo:inline>
                </fo:block>
                <fo:block>&#x00A0;</fo:block>
                <fo:block>
                    <fo:inline font-size="10pt" font-weight="bold">TEXT</fo:inline>
                    <fo:inline font-size="10pt">
                        <xsl:value-of select="text8"/>
                    </fo:inline>
                </fo:block>
            </fo:table-cell>
        </fo:table-row>

        <fo:table-row>
            <fo:table-cell padding="2pt" number-columns-spanned="3">
                <fo:block>
                    <fo:leader leader-pattern="rule" leader-length="100%"/>
                </fo:block>
            </fo:table-cell>
        </fo:table-row>
    </fo:table-body>
</fo:table>
A: 

Like in HTML, tables in XSL-FO are for tabular data. You want to use columns in your page body to have text that continues:

    <fo:simple-page-master master-name="blarg">
        <fo:region-body column-count="3" column-gap="0.5in"/>
    </fo:simple-page-master>
carillonator
This will not work for the situation I need since I cannot have the entirety of the page body in columns, I need only for the section of the page body in columns, which is why I used the table. There must be a way to flow data from one column in a table into the next column.
Steve
A: 

To have text that contains columns you need to specify the body to contain columns. Then use <fo:block span=all> for elements that need to span all columns.

For your document it may be best to create a separate simple-page-master for sections that need columns in order to minimize the need to set elements to span all columns.

Eric
A: 

You can use

<fo:simple-page-master master-name="blarg">
    <fo:region-body column-count="3" column-gap="0.5in"/>
</fo:simple-page-master>

and in the main fo:flow have something like:

<fo:block span="all>Some text that will span across all columns</fo:block>
<fo:block>some code that will flow in 3 columns</fo:block>
<fo:block span="all>Some text that will (again) span across all columns</fo:block>

If you need both 2 columns and 3 columns on the same page you will need an extension from one of the vendors. Let me know if you need that and I'll try to find it for you.

XMLDUDE