如何在生成 PDF 时 remove/reduce fo:table 中 table 行之间的默认间距
How to remove/reduce default spacing between table rows in fo:table while generating PDF
我想减少 fo:table 中行之间的行 space。我尝试在每一行上使用顶部和底部,在 fo:block 上使用 space-before 和 space-after 但没有效果。
<xsl:template match="region1">
<fo:static-content flow-name="xsl-region-before" >
<fo:table table-layout="fixed" width="100%">
<fo:table-column column-width="100%"/>
<!-- <fo:table-column column-width="20%"/> -->
<fo:table-body>
<fo:table-row><fo:table-cell><fo:block font-family="Courier" font-style="normal" font-weight="bold" white-space="pre" font-size="12pt"><xsl:value-of select="lines[1]/line"/></fo:block></fo:table-cell></fo:table-row>
<fo:table-row><fo:table-cell><fo:block font-family="Courier" font-style="normal" font-weight="bold" white-space="pre" font-size="12pt"><xsl:value-of select="lines[2]/line"/></fo:block></fo:table-cell></fo:table-row>
<fo:table-row><fo:table-cell><fo:block font-family="Courier" font-style="normal" font-weight="bold" white-space="pre" font-size="12pt"><xsl:value-of select="lines[3]/line"/></fo:block></fo:table-cell></fo:table-row>
<fo:table-row><fo:table-cell><fo:block font-family="Courier" font-style="normal" font-weight="bold" white-space="pre" font-size="12pt"><xsl:value-of select="lines[4]/line"/></fo:block></fo:table-cell></fo:table-row>
<fo:table-row><fo:table-cell><fo:block font-family="Courier" font-style="normal" font-weight="bold" white-space="pre" font-size="12pt"><xsl:value-of select="lines[5]/line"/></fo:block></fo:table-cell></fo:table-row>
</fo:table-body>
</fo:table>
</fo:static-content>
</xsl:template>
我得到的是:enter image description here
预期的是:
enter image description here
默认的行高是行高,大概是字体大小的1.2倍。设置 line-height 更适合您的情况,甚至 line-height=0
我想减少 fo:table 中行之间的行 space。我尝试在每一行上使用顶部和底部,在 fo:block 上使用 space-before 和 space-after 但没有效果。
<xsl:template match="region1">
<fo:static-content flow-name="xsl-region-before" >
<fo:table table-layout="fixed" width="100%">
<fo:table-column column-width="100%"/>
<!-- <fo:table-column column-width="20%"/> -->
<fo:table-body>
<fo:table-row><fo:table-cell><fo:block font-family="Courier" font-style="normal" font-weight="bold" white-space="pre" font-size="12pt"><xsl:value-of select="lines[1]/line"/></fo:block></fo:table-cell></fo:table-row>
<fo:table-row><fo:table-cell><fo:block font-family="Courier" font-style="normal" font-weight="bold" white-space="pre" font-size="12pt"><xsl:value-of select="lines[2]/line"/></fo:block></fo:table-cell></fo:table-row>
<fo:table-row><fo:table-cell><fo:block font-family="Courier" font-style="normal" font-weight="bold" white-space="pre" font-size="12pt"><xsl:value-of select="lines[3]/line"/></fo:block></fo:table-cell></fo:table-row>
<fo:table-row><fo:table-cell><fo:block font-family="Courier" font-style="normal" font-weight="bold" white-space="pre" font-size="12pt"><xsl:value-of select="lines[4]/line"/></fo:block></fo:table-cell></fo:table-row>
<fo:table-row><fo:table-cell><fo:block font-family="Courier" font-style="normal" font-weight="bold" white-space="pre" font-size="12pt"><xsl:value-of select="lines[5]/line"/></fo:block></fo:table-cell></fo:table-row>
</fo:table-body>
</fo:table>
</fo:static-content>
</xsl:template>
我得到的是:enter image description here
预期的是: enter image description here
默认的行高是行高,大概是字体大小的1.2倍。设置 line-height 更适合您的情况,甚至 line-height=0