如何在生成PDF时删除/减少fo:table中表行之间的默认间距

时间:2017-09-05 13:24:45

标签: xslt xsl-fo apache-fop

我想减少fo:table中行之间的行间距。我尝试在每一行和空格上使用顶部,底部 - 空格 - 空格 - 后面的fo:block并且没有效果。



<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>
&#13;
&#13;
&#13;

我得到的是:enter image description here

预期的是: enter image description here

1 个答案:

答案 0 :(得分:1)

领先的默认行高可能是字体大小的1.2倍。设置更适合您的情况的行高,甚至可能是line-height = 0