简体   繁体   中英

apache-fop: unable to set width on a container

i'm trying to generate a template for printing PDF-s. the inline container below should be fixed width, so the text doesn't overflow the elements on the right side. and i can't get it shrink.

i've tried with both block and inline containers, and various padding / margin options, but nothing worked. also width and max-width don't work.

        <xsl:if test="$vsadek/xy">
  ---->     <fo:inline-container width="40px" max-width="40px" padding-right="200pt">
                <fo:block font-weight="bold">
                    <xsl:value-of select="$vsadek/xy"></xsl:value-of>
                    <xsl:if test="$vsadek/ab">
                        <xsl:text>, </xsl:text>
                        <xsl:value-of select="$vsadek/ab"></xsl:value-of>
                    </xsl:if>
                </fo:block>
            </fo:inline-container>
        </xsl:if>

i couldn't find a solution regarding width in the container, so i just opted to make a table and it worked.

here's the code:

<xsl:if test="$vsadek/ab">
    <fo:table>
---->   <fo:table-column column-width="950px"/>
        <fo:table-body>
            <fo:table-row>
              <fo:table-cell>
                 <fo:block font-weight="bold" padding-bottom="0.3cm" keep-together.within-column="always">
                    <xsl:value-of select="$vsadek/ab"></xsl:value-of>
                    <xsl:if test="$vsadek/xy">
                        <xsl:text>, </xsl:text>
                        <xsl:value-of select="$vsadek/xy"></xsl:value-of>
                        <xsl:text>&#xa;</xsl:text>
                    </xsl:if>
                </fo:block>
            </fo:table-cell>
        </fo:table-row>
    </fo:table-body>
  </fo:table>
</xsl:if>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM