You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

PDF-XSLT中表格内容渲染不对称问题求助

双列表格PDF渲染不对称问题

我编写了一个简单的双列表格,但在PDF渲染时出现不对称情况(附截图)。以下是表格代码示例:

<xsl:template name="Header">

   <fo:table table-layout="fixed" width="100%">

    <fo:table-column column-width="proportional-column-width(1.2)" border-style="solid"/>
    <fo:table-column column-width="proportional-column-width(2)" border-style="solid"/>

     <fo:table-body>
       <fo:table-row>
         <fo:table-cell column-number="1">
          <fo:block font-size="3.5mm">
           <xsl:value-of select="xpath/get/element-val"/>
          </fo:block>
         </fo:table-cell>

         <fo:table-cell column-number="2">
          <fo:block font-size="3.5mm">
           <xsl:value-of select="xpath/get/element-val"/>
          </fo:block>
         </fo:table-cell>
       </fo:table-row>
     </fo:table-body>
   </fo:table>

</xsl:template>

我未使用复杂设置,期望两列均按第二列样式渲染,但尝试添加padding无效。

更新
曾尝试display-align="after",但无效果。

进一步更新
以下是模板调用流程:

<xsl:template name="Details">

 <fo:block font-size="4.3mm" space-after.precedence="force" space-after="-3.5mm">
   Testimonial is. 
   <fo:leader leader-pattern="rule" alignment-baseline="before-edge" rule-thickness=".5mm" leader-length="255.4mm" color="cmyk(0,0,0,1)"/>
 </fo:block>
  <!--Here page available width is 255.4 only-->
   <xsl:call-template name="Temp2"/>
   <xsl:call-template name="Header"/>
 </xsl:template>
 
  <xsl:template name="Temp2">

  <fo:table table-layout="fixed" width="100%">

    <fo:table-column column-width="33mm"/>
    <fo:table-column column-width="proportional-column-width(1)"/>

    <fo:table-body>

    <fo:table-row>
     <xsl:for-each select="xpath/get/element-val">
      <xsl:if test=".='D'">
        <fo:table-cell column-number="1">
          <fo:block>
           <fo:inline font-size="3.4mm" text-decoration="underline" writing-mode="lr">
             <xsl:value-of select="following-sibling::*[1]"/>
           </fo:inline>
          </fo:block>
         </fo:table-cell>
      </xsl:if>
     </xsl:for-each>

     <xsl:for-each select="xpath/get/element-val">
      <xsl:if test=".='E'">
        <fo:table-cell column-number="2">
         <fo:block font-size="3.4mm" writing-mode="lr" padding-top="1mm">
           <xsl:value-of select="concat(.,' ',following-sibling::*[1])"/>
          </fo:block>
        </fo:table-cell>
      </xsl:if>
     </xsl:for-each>
    </fo:table-row>

   </fo:table-body>

  </fo:table>

</xsl:template>

内容的提问来源于stack exchange,提问作者Rito Sarkar

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.21 04:30:08