Set maximum block height and trim content

Fabian Zeindl picture Fabian Zeindl · Jul 4, 2011 · Viewed 8.8k times · Source

I have a table in an XSL-FO document and in a cell there's an article description, which can easily overflow a page, so I want it to be just cut after reaching a certain height with the cell. Is that possible? This is my example, I tried setting:

height="4cm"

and

block-dimension-progression.maximum="4cm"

but it doesn't work.

<fo:table-row keep-together.within-page="always"  height="2cm">
    <fo:table-cell border-right="1.5pt solid black">
        <fo:block text-align="center">
            <xsl:value-of select="count"/>
        </fo:block>
    </fo:table-cell>
    <fo:table-cell border-right="1.5pt solid black" padding-left="2pt">
        <fo:block>
            <xsl:value-of select="name"/>
        </fo:block>
        <fo:block font-size="10pt"><xsl:value-of select="manufacturer"/> / <xsl:value-of select="identifier"/></fo:block>
        <fo:block font-size="10pt"><xsl:value-of select="description"/></fo:block>
    </fo:table-cell>
    <fo:table-cell border-right="1.5pt solid black" padding-right="2pt">
        <fo:block text-align="right">
            <xsl:value-of select="unitprice"/>
        </fo:block>
    </fo:table-cell>
    <fo:table-cell>
        <fo:block text-align="right">
            <xsl:value-of select="totalprice"/>
        </fo:block>
    </fo:table-cell>
</fo:table-row>

Answer

mzjn picture mzjn · Jul 7, 2011

Put the block with the article description in a block-container with overflow="hidden" and the desired height set. Like this:

<fo:block-container overflow="hidden" height="2cm">
 <fo:block font-size="10pt">Long description text goes here...</fo:block>
</fo:block-container>