我想在<fo:table>
的最左列中显示具有更大字体的文本。但是,右侧的列应由几行较小的文本组成。
这是在添加任何具有较大文本的最左列之前,XSL代码的样子:
<xsl:template name="printAddress">
<xsl:param name="subDocument" />
<fo:table table-layout="fixed" background-color="#e0e0e0" keep-with-next.within-page="always">
<fo:table-column column-width="7.0cm" />
<fo:table-column column-width="7.0cm" />
<fo:table-column column-width="2.0cm" />
<fo:table-body>
<!-- Begin Row 1 -->
<fo:table-row keep-with-previous="always">
<fo:table-cell margin-left="0.2cm" padding-before="0.1cm" padding-after="0.1cm">
<fo:block>Value 1</fo:block>
</fo:table-cell>
<fo:table-cell margin-left="0.2cm" padding-before="0.1cm" padding-after="0.1cm">
<fo:block>Value 2</fo:block>
</fo:table-cell>
<fo:table-cell margin-left="0.2cm" padding-before="0.1cm" padding-after="0.1cm">
<fo:block />
</fo:table-cell>
</fo:table-row>
<!-- Begin Row 2 -->
<fo:table-row keep-with-previous="always">
<fo:table-cell margin-left="0.2cm" padding-before="0.1cm" padding-after="0.1cm">
<fo:block>
<xsl:value-of select="$subDocument/someAttribute" />
</fo:block>
</fo:table-cell>
<fo:table-cell margin-left="0.2cm" padding-before="0.1cm" padding-after="0.1cm">
<fo:block>
<xsl:value-of select="$subDocument/someOtherAttribute" />
</fo:block>
</fo:table-cell>
<fo:table-cell margin-left="0.2cm" padding-before="0.1cm" padding-after="0.1cm">
<fo:block />
</fo:table-cell>
</fo:table-row>
<!-- Begin Row 3 -->
<fo:table-row keep-with-previous="always">
<fo:table-cell margin-left="0.2cm" padding-before="0.1cm" padding-after="0.1cm">
<fo:block>value 3</fo:block>
</fo:table-cell>
<fo:table-cell margin-left="0.2cm" padding-before="0.1cm" padding-after="0.1cm">
<fo:block>Value 4</fo:block>
</fo:table-cell>
<fo:table-cell margin-left="0.2cm" padding-before="0.1cm" padding-after="0.1cm">
<fo:block>Value 5</fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>
</xsl:template>
我想在左侧添加一列,但是找不到它的语法。在HTML中,上面的代码将如下所示:
<tr>
<td>Value 1</td>
<td>Value 2</td>
<td></td>
</tr>
<tr>
<td>{someAttribute}</td>
<td>{someOtherAttribute}</td>
<td></td>
</tr>
<tr>
<td>Value 3</td>
<td>Value 4</td>
<td>Value 5</td>
</tr>
并完成我想要的,我们只需要像这样修改它:
<tr>
<td rowspan="3" style="font-weight:bold;font-size:14pt">New Text</td>
<td>Value 1</td>
<td>Value 2</td>
<td></td>
</tr>
<tr>
<td>{someAttribute}</td>
<td>{someOtherAttribute}</td>
<td></td>
</tr>
<tr>
<td>Value 3</td>
<td>Value 4</td>
<td>Value 5</td>
</tr>
但是,如何最好地使用XSL-FO?
最佳答案
<fo:table-cell number-rows-spanned="3">
您不只是爱XSL这么罗word吗?
关于xslt - 有没有办法在XSL-FO中使用等效的“rowspan”?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/1713699/