设置最大块高度和修剪内容

时间:2011-07-04 16:31:12

标签: block xsl-fo

我在XSL-FO文档中有一个表格,在一个单元格中有一篇文章描述,它可以很容易地溢出页面,所以我希望它在与单元格达到一定高度后才被剪切。那可能吗?这是我的例子,我试着设置:

height="4cm"

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

但它不起作用。

<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>

1 个答案:

答案 0 :(得分:7)

将带有文章描述的块放在一个overflow="hidden"的块容器中,并设置所需的高度。像这样:

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