重叠表中的单元格

时间:2015-05-07 13:21:55

标签: xslt xsl-fo

screenshot table

我在XSLT中创建了一个表,我在其中使用XSL-fo来表示某些对象。在这种情况下,我想将图像放在绿线上方的文本后面。 在屏幕截图中,您会看到第二个文本行被切成两半,但我希望以正确的方式显示文本行,而不会向下移动图像。 我已经尝试了z-index,块容器,背景图像,填充,但我还没有解决方案。

图像位于表格单元格和文本中。绿线实际上是图像的表格单元格的背景颜色。

<fo:block break-before="auto"/>
<fo:block keep-together="auto" ><!-- GENERATE TABLE START-->
<xsl:if test="Product[count(ProductID) &gt; 0]">
<fo:table table-layout="fixed" padding-bottom="0.0pt" start-indent="0.0pt" end-indent="0.0pt" padding-top="0.0pt" padding="0.0pt">
<fo:table-column column-width="10.0mm"/>
<fo:table-column column-width="24.5mm"/>
<fo:table-column column-width="3.0mm"/>
<fo:table-column column-width="4.0mm"/>
<fo:table-column column-width="48.5mm"/>
<fo:table-column column-width="4.0mm"/>
<fo:table-column column-width="48.5mm"/>
<fo:table-column column-width="31.0mm"/>
<fo:table-column column-width="10.0mm"/>
<fo:table-column column-width="5.8mm"/>

<!--header-->
<fo:table-header>
<fo:table-row height="5.0mm">
<!--empty cell-->
    <fo:table-cell/>
<!--header 1-->
    <fo:table-cell padding-bottom="0.0pt" start-indent="0.0pt" end-indent="0.0pt" padding-top="0.0pt" padding="0.0pt" display-align="before" width="69.7pt"  reference-orientation="0">
        <fo:block break-before="auto"/>
        <fo:block line-height="10.799999999999999pt" white-space-collapse="false"  linefeed-treatment="preserve" white-space-treatment="preserve"  hyphenate="false" language="en"  padding-bottom="0.0pt" start-indent="4.26791pt" end-indent="0.0pt" padding-top="2.41848pt" text-align="start" keep-together="auto"  color="rgb-icc(1,1,1, #CMYK, 0.0,0.0,0.0,1.0)" font-family="Frutiger LT 57 Condensed" font-size="9.0pt" letter-spacing="normal" word-spacing="normal">
            <xsl:text>Suitable for</xsl:text>
        </fo:block>
        <fo:block break-after="auto"/>
    </fo:table-cell>
<!--empty cell-->
    <fo:table-cell padding-bottom="0.0pt" start-indent="0.0pt" end-indent="0.0pt" padding-top="0.0pt" padding="0.0pt" display-align="before" width="8.5pt"  reference-orientation="0">
        <fo:block break-before="auto"/>
        <fo:block white-space-collapse="false" linefeed-treatment="preserve" white-space-treatment="preserve"  hyphenate="false" language="en"  padding-bottom="0.0pt" start-indent="0.0pt" end-indent="0.0pt" padding-top="0.0pt" padding="0.0pt" text-align="start" keep-together="auto"  letter-spacing="normal" word-spacing="normal">
        </fo:block>
        <fo:block break-after="auto"/>
    </fo:table-cell>
<!--header 2-->
    <fo:table-cell padding-bottom="0.0pt" start-indent="0.0pt" end-indent="0.0pt" padding-top="0.0pt" padding="0.0pt" number-columns-spanned="2" display-align="before" width="11.4pt"  reference-orientation="0">
        <fo:block break-before="auto"/>
        <fo:block white-space-collapse="false"  linefeed-treatment="preserve" white-space-treatment="preserve"  hyphenate="false" language="en"  padding-bottom="0.0pt" start-indent="0.0pt" end-indent="0.0pt" padding-top="2.41848pt" text-align="start" keep-together="auto"  color="rgb-icc(1,1,1, #CMYK, 0.0,0.0,0.0,1.0)" font-family="Frutiger LT 87 Extra Black Condensed" font-size="9.0pt" letter-spacing="normal" word-spacing="normal">
            <xsl:text>Description</xsl:text></fo:block>
        <fo:block break-after="auto"/>
    </fo:table-cell>
<!--empty cell-->
    <fo:table-cell padding-bottom="0.0pt" start-indent="0.0pt" end-indent="0.0pt" padding-top="0.0pt" padding="0.0pt" display-align="before" width="11.4pt"  reference-orientation="0">
        <fo:block break-before="auto"/>
        <fo:block white-space-collapse="false"  linefeed-treatment="preserve" white-space-treatment="preserve"  hyphenate="false" language="en"  padding-bottom="0.0pt" start-indent="0.0pt" end-indent="0.0pt" padding-top="0.0pt" padding="0.0pt" text-align="start" keep-together="auto"  letter-spacing="normal" word-spacing="normal">
        </fo:block>
        <fo:block break-after="auto"/>
    </fo:table-cell>
<!--header 3-->
    <fo:table-cell padding-bottom="0.0pt" start-indent="0.0pt" end-indent="0.0pt" padding-top="0.0pt" padding="0.0pt" display-align="before" width="138.0pt"  reference-orientation="0">
        <fo:block break-before="auto"/>
        <fo:block line-height="10.799999999999999pt" white-space-collapse="false"  linefeed-treatment="preserve" white-space-treatment="preserve"  hyphenate="false" language="en"  padding-bottom="0.0pt" start-indent="-5.6999pt" end-indent="0.0pt" padding-top="2.41848pt" text-align="start" keep-together="auto"  color="rgb-icc(1,1,1, #CMYK, 0.0,0.0,0.0,1.0)" font-family="Frutiger LT 57 Condensed" font-size="9.0pt" letter-spacing="normal" word-spacing="normal">
        <fo:block text-align="left" white-space-collapse="false"  hyphenate="false" language="en"  linefeed-treatment="preserve" white-space-treatment="preserve" >
        <fo:inline padding-bottom="0.0pt" start-indent="-5.6999pt" end-indent="0.0pt" padding-top="2.41848pt">
            <xsl:text>Details</xsl:text>
        </fo:inline>
        </fo:block>
        </fo:block>
        <fo:block break-after="auto"/>
    </fo:table-cell>
<!--header 4-->
    <fo:table-cell padding-bottom="0.0pt" start-indent="0.0pt" end-indent="0.0pt" padding-top="0.0pt" padding="0.0pt" display-align="before" width="88.20354pt"  reference-orientation="0">
        <fo:block break-before="auto"/>
        <fo:block line-height="10.799999999999999pt" white-space-collapse="false"  linefeed-treatment="preserve" white-space-treatment="preserve"  hyphenate="false" language="en"  padding-bottom="0.0pt" start-indent="11.4pt" end-indent="0.0pt" padding-top="2.41848pt" text-align="start" keep-together="auto"  color="rgb-icc(1,1,1, #CMYK, 0.0,0.0,0.0,1.0)" font-family="Frutiger LT 57 Condensed" font-size="9.0pt" letter-spacing="normal" word-spacing="normal">
            <xsl:text>Replaces</xsl:text>
        </fo:block>
        <fo:block break-after="auto"/>
    </fo:table-cell>
<!--header 5-->
    <fo:table-cell padding-bottom="0.0pt" start-indent="0.0pt" end-indent="0.0pt" padding-top="0.0pt" padding="0.0pt" number-columns-spanned="2" display-align="before" width="28.5pt"  reference-orientation="0">
        <fo:block break-before="auto"/>
        <fo:block white-space-collapse="false"  linefeed-treatment="preserve" white-space-treatment="preserve"  hyphenate="false" language="en"  padding-bottom="0.0pt" start-indent="7.7pt" end-indent="0.0pt" padding-top="2.41848pt" text-align="start" keep-together="auto"  color="rgb-icc(1,1,1, #CMYK, 0.0,0.0,0.0,1.0)" font-family="Frutiger LT 87 Extra Black Condensed" font-size="9.0pt" letter-spacing="normal" word-spacing="normal">
            <xsl:text>No.</xsl:text>
        </fo:block>
        <fo:block break-after="auto"/>
    </fo:table-cell>
</fo:table-row>
</fo:table-header>

<fo:table-body>
<xsl:for-each select="Product[count(ProductID) &gt; 0]">
<!--empty cells-->
    <fo:table-row height="0.0pt">
        <fo:table-cell/>
        <fo:table-cell/>
        <fo:table-cell/>
        <fo:table-cell/>
        <fo:table-cell/>
        <fo:table-cell/>
        <fo:table-cell/>
        <fo:table-cell/>
        <fo:table-cell/>
        <fo:table-cell/>
    </fo:table-row>

    <fo:table-row keep-together.within-line="always" keep-together.within-column="always" keep-together.within-page="always" keep-with-next="always">
        <fo:table-cell/>
<!--content concerning 'Suitable for'-->
        <fo:table-cell padding-bottom="0.0pt" start-indent="0.0pt" end-indent="0.0pt" padding-top="0.0pt" padding="0.0pt" number-rows-spanned="14" display-align="before" width="69.7pt"  reference-orientation="0">
            <fo:block break-before="auto"/>
            <fo:block position="relative" text-align="start" color="rgb-icc(0,0,0, #CMYK, 0.65,0.53,0.51,1.0)" font-family="Arial" font-size="11.0pt" white-space-collapse="false"  linefeed-treatment="preserve" white-space-treatment="preserve"  hyphenate="false" language="en"  padding-bottom="0.0pt" start-indent="4.26791pt" end-indent="0.0pt" padding-top="7.1pt" display-align="before">

<!--some code-->    

            </fo:block>
            <fo:block break-after="auto"/>
        </fo:table-cell>
<!--empty cell-->
        <fo:table-cell/>
<!--language blocks-->
        <fo:table-cell padding-bottom="0.0pt" start-indent="0.0pt" end-indent="0.0pt" padding-top="0.0pt" padding="0.0pt" number-rows-spanned="2" number-columns-spanned="2" display-align="before" width="11.4pt"  reference-orientation="0">
            <fo:block position="relative" text-align="start" color="rgb-icc(1,1,1, #CMYK, 0.0,0.0,0.0,1.0)" font-family="Arial" font-size="12.0pt" white-space-collapse="false"  linefeed-treatment="preserve" white-space-treatment="preserve"  hyphenate="false" language="en"  padding-bottom="0.0pt" start-indent="0.0pt" end-indent="0.0pt" padding-top="2.84527pt" display-align="before">

<!--some code-->
            </fo:block>
        </fo:table-cell>
<!--empty cell-->
        <fo:table-cell/>
<!--concent concerning 'Details'-->
        <fo:table-cell padding-bottom="0.0pt" start-indent="0.0pt" end-indent="0.0pt" padding-top="0.0pt" padding="0.0pt" display-align="before" width="138.0pt"  reference-orientation="0">
            <fo:block break-before="auto"/>
            <fo:block line-height="10.799999999999999pt" white-space-collapse="false"  linefeed-treatment="preserve" white-space-treatment="preserve"  hyphenate="false" language="en"  padding-bottom="0.78245pt" start-indent="-5.6999pt" end-indent="0.0pt" padding-top="6.5pt" text-align="start" background-color="transparent" keep-together="auto"  color="rgb-icc(1,1,1, #CMYK, 0.0,0.0,0.0,1.0)" font-family="Frutiger 57 Condensed" font-size="9.0pt" letter-spacing="normal" word-spacing="normal">
                <xsl:value-of disable-output-escaping="no" select="Matchcode"/>
            </fo:block>
            <fo:block break-after="auto"/>
        </fo:table-cell>
<!--content concerning 'Replaces'-->
        <fo:table-cell padding-bottom="0.0pt" start-indent="0.0pt" end-indent="0.0pt" padding-top="0.0pt" padding="0.0pt" display-align="before" width="88.20354pt"  reference-orientation="0">
            <fo:block position="relative" text-align="start" color="rgb-icc(1,1,1, #CMYK, 0.0,0.0,0.0,1.0)" font-family="Arial" font-size="11.0pt" white-space-collapse="false"  linefeed-treatment="preserve" white-space-treatment="ignore-if-after-linefeed"  hyphenate="true" language="en"  padding-bottom="0.0pt" start-indent="0.0pt" end-indent="0.0pt" padding-top="6.5pt" display-align="before">
                <xsl:call-template name="tmpManufacturer_ref"></xsl:call-template>
            </fo:block>
        </fo:table-cell>
<!--content concerning 'No.'-->
        <fo:table-cell padding-bottom="0.0pt" start-indent="0.0pt" end-indent="0.0pt" padding-top="0.0pt" padding="0.0pt" number-columns-spanned="2" display-align="before" width="28.5pt"  reference-orientation="0">
            <fo:block break-before="auto"/>
            <fo:block white-space-collapse="false"  linefeed-treatment="preserve" white-space-treatment="preserve"  hyphenate="false" language="en"  padding-bottom="0.0pt" start-indent="0.0pt" end-indent="0.0pt" padding-top="5.69055pt" text-align="end" background-color="transparent" keep-together="auto"  color="rgb-icc(1,1,1, #CMYK, 0.0,0.0,0.0,1.0)" font-family="Frutiger LT 87 Extra Black Condensed" font-size="11.0pt" letter-spacing="normal" word-spacing="normal">
                <xsl:value-of disable-output-escaping="no" select="ProductID"/>
            </fo:block>
            <fo:block break-after="auto"/>
        </fo:table-cell>
    </fo:table-row>


    <fo:table-row keep-together.within-line="always" keep-together.within-column="always" keep-together.within-page="always" keep-with-next="always" keep-with-previous="always">
<!--empty cells-->
        <fo:table-cell/>
        <fo:table-cell/>
        <fo:table-cell/>
<!--product images-->
        <fo:table-cell padding-bottom="0.0pt" start-indent="0.0pt" end-indent="0.0pt" padding-top="0.0pt" padding="0.0pt" number-rows-spanned="13" number-columns-spanned="2" display-align="center" width="138.0pt"  reference-orientation="0">
            <xsl:choose>
            <xsl:when test="contains(Documents/Document/DocumentAssets/DocumentAsset/DocumentURL,'_LL') and Documents/Document/DocumentAssets/DocumentAsset/UsageTypeID = 'normal'">
                <fo:block position="relative" text-align="center" padding-top="2.0mm" padding-bottom="-2.0mm" display-align="center" color="rgb-icc(1,1,1, #CMYK, 0.0,0.0,0.0,1.0)" font-family="Arial" font-size="12.0pt">
                    <xsl:call-template name="tmpBildLL" />
                </fo:block>
            </xsl:when>
            <xsl:when test="contains(Documents/Document/DocumentAssets/DocumentAsset/DocumentURL,'_L') and Documents/Document/DocumentAssets/DocumentAsset/UsageTypeID = 'normal'">     
                <fo:block position="relative" text-align="center" display-align="center" color="rgb-icc(1,1,1, #CMYK, 0.0,0.0,0.0,1.0)" font-family="Arial" font-size="12.0pt">
                    <xsl:call-template name="tmpBildL" />
                </fo:block>
            </xsl:when>
            <xsl:when test="contains(Documents/Document/DocumentAssets/DocumentAsset/DocumentURL,'_M') and Documents/Document/DocumentAssets/DocumentAsset/UsageTypeID = 'normal'">
                <fo:block position="relative" text-align="center" display-align="center" color="rgb-icc(1,1,1, #CMYK, 0.0,0.0,0.0,1.0)" font-family="Arial" font-size="12.0pt">
                    <xsl:call-template name="tmpBildM" />
                </fo:block>
            </xsl:when>
            <xsl:when test="contains(Documents/Document/DocumentAssets/DocumentAsset/DocumentURL,'_KK') and Documents/Document/DocumentAssets/DocumentAsset/UsageTypeID = 'normal'">
                <fo:block position="relative" text-align="center" display-align="center" color="rgb-icc(1,1,1, #CMYK, 0.0,0.0,0.0,1.0)" font-family="Arial" font-size="12.0pt">
                    <xsl:call-template name="tmpBildKK" />
                </fo:block>
            </xsl:when>
            <xsl:when test="contains(Documents/Document/DocumentAssets/DocumentAsset/DocumentURL,'_K') and Documents/Document/DocumentAssets/DocumentAsset/UsageTypeID = 'normal'">
                <fo:block position="relative" text-align="center" display-align="center" color="rgb-icc(1,1,1, #CMYK, 0.0,0.0,0.0,1.0)" font-family="Arial" font-size="12.0pt">
                    <xsl:call-template name="tmpBildK" />
                </fo:block>
            </xsl:when>
            <xsl:otherwise>
                <fo:block position="relative" text-align="center" display-align="center" color="rgb-icc(1,1,1, #CMYK, 0.0,0.0,0.0,1.0)" font-family="Arial" font-size="12.0pt">
                    <xsl:call-template name="tmpBildUnisize" />
                </fo:block>
            </xsl:otherwise>
            </xsl:choose>
        </fo:table-cell>
<!--image QR code-->
        <fo:table-cell padding-bottom="0.0pt" start-indent="0.0pt" end-indent="0.0pt" padding-top="0.0pt" padding="0.0pt" number-rows-spanned="11" number-columns-spanned="2" display-align="before" width="28.5pt"  reference-orientation="0">
            <fo:block position="relative" text-align="end" color="rgb-icc(0,0,0, #CMYK, 0.65,0.53,0.51,1.0)" font-family="Arial" font-size="12.0pt" white-space-collapse="false"  linefeed-treatment="preserve" white-space-treatment="ignore-if-surrounding-linefeed"  hyphenate="true" language="en"  padding-bottom="0.0pt" start-indent="0.0pt" end-indent="0.0pt" padding-top="2.8pt" display-align="before">
                <xsl:choose>
                <xsl:when test="string-length(QR_CODE) &gt; 0">
                    <xsl:call-template name="tmpQRCode" />
                </xsl:when>
                <xsl:otherwise>
                </xsl:otherwise>
                </xsl:choose>
            </fo:block>
        </fo:table-cell>
    </fo:table-row>

    <fo:table-row height="0.71131pt" keep-together.within-line="always" keep-together.within-column="always" keep-together.within-page="always" keep-with-next="always" keep-with-previous.within-line="always" keep-with-previous.within-column="always" keep-with-previous.within-page="always">
<!--empty cells-->
        <fo:table-cell/>
        <fo:table-cell/>
        <fo:table-cell/>
        <fo:table-cell/>
        <fo:table-cell/>
    </fo:table-row>

    <fo:table-row keep-together.within-line="always" keep-together.within-column="always" keep-together.within-page="always" keep-with-next="always" keep-with-previous="always">
<!--empty cells-->
        <fo:table-cell/>
        <fo:table-cell/>
<!--language blocks-->
        <fo:table-cell padding-bottom="0.0pt" start-indent="0.0pt" end-indent="0.0pt" padding-top="0.0pt" padding="0.0pt" number-columns-spanned="2" display-align="before" width="11.4pt"  reference-orientation="0">
            <fo:block position="relative" text-align="start" color="rgb-icc(1,1,1, #CMYK, 0.0,0.0,0.0,1.0)" font-family="Arial" font-size="12.0pt" white-space-collapse="false"  linefeed-treatment="preserve" white-space-treatment="preserve"  hyphenate="false" language="en"  padding-bottom="0.0pt" start-indent="0.0pt" end-indent="0.0pt" padding-top="0.0pt" padding="0.0pt" display-align="before">
<!--some code>
            </fo:block>
        </fo:table-cell>
<!--empty cell-->
        <fo:table-cell/>
    </fo:table-row>

    <fo:table-row height="0.71131pt" keep-together.within-line="always" keep-together.within-column="always" keep-together.within-page="always" keep-with-next="always" keep-with-previous.within-line="always" keep-with-previous.within-column="always" keep-with-previous.within-page="always">
<!--empty cells-->
        <fo:table-cell/>
        <fo:table-cell/>
<!--language blocks-->
        <fo:table-cell padding-bottom="0.0pt" start-indent="0.0pt" end-indent="0.0pt" padding-top="0.0pt" padding="0.0pt" number-rows-spanned="2" number-columns-spanned="2" display-align="before" width="11.4pt"  reference-orientation="0">
            <fo:block position="relative" text-align="start" color="rgb-icc(1,1,1, #CMYK, 0.0,0.0,0.0,1.0)" font-family="Arial" font-size="12.0pt" white-space-collapse="false"  linefeed-treatment="preserve" white-space-treatment="preserve"  hyphenate="false" language="en"  padding-bottom="0.0pt" start-indent="0.0pt" end-indent="0.0pt" padding-top="0.0pt" padding="0.0pt" display-align="before">
<!--some code>
            </fo:block>
        </fo:table-cell>
<!--empty cell-->
        <fo:table-cell/>
    </fo:table-row>

    <fo:table-row keep-together.within-line="always" keep-together.within-column="always" keep-together.within-page="always" keep-with-next="always" keep-with-previous="always">   
<!--empty cells-->
        <fo:table-cell/>
        <fo:table-cell/>
        <fo:table-cell/>
    </fo:table-row>

    <fo:table-row height="0.71131pt" keep-together.within-line="always" keep-together.within-column="always" keep-together.within-page="always" keep-with-next="always" keep-with-previous.within-line="always" keep-with-previous.within-column="always" keep-with-previous.within-page="always">
<!--empty cells-->
        <fo:table-cell/>
        <fo:table-cell/>
<!--lanuguage blocks-->
        <fo:table-cell padding-bottom="0.0pt" start-indent="0.0pt" end-indent="0.0pt" padding-top="0.0pt" padding="0.0pt" number-rows-spanned="2" number-columns-spanned="2" display-align="before" width="11.4pt"  reference-orientation="0">
            <fo:block position="relative" text-align="start" color="rgb-icc(1,1,1, #CMYK, 0.0,0.0,0.0,1.0)" font-family="Arial" font-size="12.0pt" white-space-collapse="false"  linefeed-treatment="preserve" white-space-treatment="preserve"  hyphenate="false" language="en"  padding-bottom="0.0pt" start-indent="0.0pt" end-indent="0.0pt" padding-top="0.0pt" padding="0.0pt" display-align="before">
<!--some code>
            </fo:block>
        </fo:table-cell>
<!--empty cell-->
        <fo:table-cell/>
    </fo:table-row>

    <fo:table-row keep-together.within-line="always" keep-together.within-column="always" keep-together.within-page="always" keep-with-next="always" keep-with-previous="always">
<!--empty cells-->
        <fo:table-cell/>
        <fo:table-cell/>
        <fo:table-cell/>
    </fo:table-row>

    <fo:table-row height="0.7113pt" keep-with-next="always">
<!--empty cells-->
        <fo:table-cell/>
        <fo:table-cell/>
<!--language blocks-->
        <fo:table-cell padding-bottom="0.0pt" start-indent="0.0pt" end-indent="0.0pt" padding-top="0.0pt" padding="0.0pt" number-rows-spanned="2" number-columns-spanned="2" display-align="before" width="11.4pt"  reference-orientation="0">
            <fo:block position="relative" text-align="start" color="rgb-icc(0,0,0, #CMYK, 0.65,0.53,0.51,1.0)" font-family="Arial" font-size="12.0pt" white-space-collapse="false"  linefeed-treatment="preserve" white-space-treatment="preserve"  hyphenate="false" language="en"  padding-bottom="0.0pt" start-indent="0.0pt" end-indent="0.0pt" padding-top="0.0pt" padding="0.0pt" display-align="before">
<!--some code-->
            </fo:block>
        </fo:table-cell>
<!--empty cell-->
        <fo:table-cell/>
    </fo:table-row>

    <fo:table-row keep-together.within-line="always" keep-together.within-column="always" keep-together.within-page="always" keep-with-next="always" keep-with-previous="always">
<!--empty cells-->
        <fo:table-cell/>
        <fo:table-cell/>
        <fo:table-cell/>
    </fo:table-row>

    <fo:table-row height="0.71131pt" keep-together.within-line="always" keep-together.within-column="always" keep-together.within-page="always" keep-with-next="always">
<!--empty cells-->
        <fo:table-cell/>
        <fo:table-cell/>
        <fo:table-cell/>
        <fo:table-cell/>
        <fo:table-cell/>
    </fo:table-row>

    <fo:table-row keep-together.within-line="always" keep-together.within-column="always" keep-together.within-page="always" keep-with-next="always" keep-with-previous="always">
<!--empty cells-->
        <fo:table-cell/>
        <fo:table-cell/>
<!--language blocks-->
        <fo:table-cell padding-bottom="0.0pt" start-indent="0.0pt" end-indent="0.0pt" padding-top="0.0pt" padding="0.0pt" number-columns-spanned="2" display-align="before" width="11.4pt"  reference-orientation="0">
            <fo:block position="relative" text-align="start" color="rgb-icc(0,0,0, #CMYK, 0.65,0.53,0.51,1.0)" font-family="Arial" font-size="12.0pt" white-space-collapse="false"  linefeed-treatment="preserve" white-space-treatment="preserve"  hyphenate="false" language="en"  padding-bottom="0.0pt" start-indent="0.0pt" end-indent="0.0pt" padding-top="0.0pt" padding="0.0pt" display-align="before">
<!--some code-->
            </fo:block>
        </fo:table-cell>
        <fo:table-cell/>
    </fo:table-row>

    <fo:table-row height="0.71131pt" keep-together.within-line="always" keep-together.within-column="always" keep-together.within-page="always" keep-with-next.within-line="always" keep-with-next.within-column="always" keep-with-next.within-page="always" keep-with-previous.within-line="always" keep-with-previous.within-column="always" keep-with-previous.within-page="always">
<!--empty cell-->
        <fo:table-cell/>
<!--code for generating page number-->
        <fo:table-cell padding-bottom="0.0pt" start-indent="0.0pt" end-indent="0.0pt" padding-top="0.0pt" padding="0.0pt" number-rows-spanned="2" display-align="before" width="8.5pt"  reference-orientation="0">
            <fo:block position="relative" text-align="start" color="rgb-icc(0,0,0, #CMYK, 0.65,0.53,0.51,1.0)" font-family="Arial" font-size="12.0pt" white-space-collapse="false"  linefeed-treatment="preserve" white-space-treatment="preserve"  hyphenate="false" language="en"  padding-bottom="0.0pt" start-indent="0.0pt" end-indent="0.0pt" padding-top="0.0pt" padding="0.0pt" display-align="before">
                <fo:block id="{generate-id(.)}"/>
            </fo:block>
        </fo:table-cell>
<!--empty cells-->
        <fo:table-cell/>
        <fo:table-cell/>
        <fo:table-cell/>
        <fo:table-cell/>
        <fo:table-cell/>
    </fo:table-row>

    <fo:table-row keep-together.within-line="always" keep-together.within-column="always" keep-together.within-page="always" keep-with-next.within-line="always" keep-with-next.within-column="always" keep-with-next.within-page="always">
<!--empty cell-->
        <fo:table-cell/>
<!--language blocks-->
        <fo:table-cell padding-bottom="0.0pt" start-indent="0.0pt" end-indent="0.0pt" padding-top="0.0pt" padding="0.0pt" number-columns-spanned="2" display-align="before" width="11.4pt"  reference-orientation="0">
            <fo:block position="relative" text-align="start" color="rgb-icc(1,1,1, #CMYK, 0.0,0.0,0.0,1.0)" font-family="Arial" font-size="12.0pt" white-space-collapse="false"  linefeed-treatment="preserve" white-space-treatment="preserve"  hyphenate="false" language="en"  padding-bottom="0.0pt" start-indent="0.0pt" end-indent="0.0pt" padding-top="0.0pt" padding="0.0pt" display-align="before">

<!--some code-->

            </fo:block>
        </fo:table-cell>
<!--code for generating page numbers-->
        <fo:table-cell padding-bottom="0.0pt" start-indent="0.0pt" end-indent="0.0pt" padding-top="0.0pt" padding="0.0pt" display-align="before" width="11.4pt"  reference-orientation="0">
            <fo:block position="relative" text-align="start" color="rgb-icc(0,0,0, #CMYK, 0.65,0.53,0.51,1.0)" font-family="Arial" font-size="12.0pt" white-space-collapse="false"  linefeed-treatment="preserve" white-space-treatment="preserve"  hyphenate="false" language="en"  padding-bottom="0.0pt" start-indent="0.0pt" end-indent="0.0pt" padding-top="0.0pt" padding="0.0pt" display-align="before">
                <xsl:call-template name="tmpOEM" />
                <xsl:call-template name="tmpOEM_other" />
            </fo:block>
        </fo:table-cell>
<!--Special product-->
        <fo:table-cell padding-bottom="0.0pt" start-indent="0.0pt" end-indent="0.0pt" padding-top="0.0pt" padding="0.0pt" display-align="before" width="28.5pt"  reference-orientation="0">
            <fo:block position="relative" text-align="start" color="rgb-icc(0,0,0, #CMYK, 0.65,0.53,0.51,1.0)" font-family="Arial" font-size="11.0pt" white-space-collapse="false"  linefeed-treatment="preserve" white-space-treatment="ignore-if-surrounding-linefeed"  hyphenate="true" language="en"  padding-bottom="0.0pt" start-indent="0.0pt" end-indent="0.0pt" padding-top="2.8453pt" display-align="before">

<!--some code-->
            </fo:block>
        </fo:table-cell>
<!--New Product-->
        <fo:table-cell padding-bottom="0.0pt" start-indent="0.0pt" end-indent="0.0pt" padding-top="0.0pt" padding="0.0pt" display-align="before" width="16.5pt"  reference-orientation="0">
            <fo:block position="relative" text-align="start" color="rgb-icc(0,0,0, #CMYK, 0.65,0.53,0.51,1.0)" font-family="Arial" font-size="11.0pt" white-space-collapse="false"  linefeed-treatment="preserve" white-space-treatment="preserve"  hyphenate="true" language="en"  padding-bottom="0.0pt" start-indent="0.0pt" end-indent="0.0pt" padding-top="0.0pt" padding="0.0pt" display-align="before">
                <xsl:if test="NewInCat='Y'">
                    <xsl:call-template name="TemplateNEW"></xsl:call-template>
                </xsl:if>
            </fo:block>
        </fo:table-cell>
    </fo:table-row>

    <fo:table-row keep-with-previous="always">
<!--empty cells-->
        <fo:table-cell/>
        <fo:table-cell border-bottom-style="solid" border-bottom-width="0.30001pt" border-bottom-color="rgb-icc(1,1,1, #CMYK, 0.0,0.0,0.0,1.0)" padding-bottom="0.0pt" start-indent="0.0pt" end-indent="0.0pt" padding-top="0.0pt" padding="0.0pt" number-columns-spanned="9" display-align="before" width="69.7pt"  reference-orientation="0">
            <fo:block break-before="auto"/>
            <fo:block white-space-collapse="false"  linefeed-treatment="preserve" white-space-treatment="preserve"  hyphenate="false" language="en"  padding-bottom="0.0pt" start-indent="0.0pt" end-indent="0.0pt" padding-top="5.7pt" text-align="start" keep-together="auto"  letter-spacing="normal" word-spacing="normal">
            </fo:block>
            <fo:block break-after="auto"/>
        </fo:table-cell>
    </fo:table-row>
</xsl:for-each>

</fo:table-body>
</fo:table>
</xsl:if>
</fo:block>
<fo:block break-after="auto"/>

1 个答案:

答案 0 :(得分:2)

在表格单元格或表格单元格内的块容器上使用背景图像对我来说很有用。这段代码:

 <fo:table>
            <fo:table-column column-width="4.7in"/>
            <fo:table-body>
                <fo:table-row>
                    <fo:table-cell background-image="test.jpg" height="2.3in" border-top="1pt solid black">
                        <fo:block text-align="right">I am some text in the table cell. </fo:block>
                        <fo:block text-align="right">I am some text in the table cell. </fo:block>
                        <fo:block text-align="right">I am some text in the table cell. </fo:block>
                        <fo:block text-align="right">I am some text in the table cell. </fo:block>
                        <fo:block text-align="right">I am some text in the table cell. </fo:block>
                        <fo:block text-align="right">I am some text in the table cell. </fo:block>
                    </fo:table-cell>
                </fo:table-row>
                <fo:table-row>
                    <fo:table-cell border-top="1pt solid black" >
                        <fo:block-container background-image="test.jpg" height="2.3in">
                            <fo:block text-align="right">I am some text in the table cell. </fo:block>
                            <fo:block text-align="right">I am some text in the table cell. </fo:block>
                            <fo:block text-align="right">I am some text in the table cell. </fo:block>
                            <fo:block text-align="right">I am some text in the table cell. </fo:block>
                            <fo:block text-align="right">I am some text in the table cell. </fo:block>
                            <fo:block text-align="right">I am some text in the table cell. </fo:block>
                        </fo:block-container>
                    </fo:table-cell>
                </fo:table-row>
            </fo:table-body>
        </fo:table>

下图中的结果。您可以看到文本与图像重叠,因为我故意这样做。你当然可以通过不重复来控制图像。除非您使用支持背景图像缩放的渲染器,否则唯一的限制是调整图像大小(如果需要控制)。 RenderX支持这一点,我不确定Apache FOP是否支持。

enter image description here