问题描述
我有以下模板来生成定义的表:
I have the following template to generate a table defined:
<xsl:template name="CreateTable">
<fo:block>
<fo:table border-style="solid" table-layout="fixed">
<fo:table-body>
<fo:table-row>
<xsl:for-each select="Table/Head/Cell">
<fo:table-cell border-style="solid">
<fo:block><xsl:value-of select="." /></fo:block>
</fo:table-cell>
</xsl:for-each>
</fo:table-row>
<xsl:for-each select="Table/Row">
<fo:table-row>
<xsl:for-each select="Cell">
<fo:table-cell border-style="solid">
<fo:block><xsl:value-of select="."/></fo:block>
</fo:table-cell>
</xsl:for-each>
</fo:table-row>
</xsl:for-each>
</fo:table-body>
</fo:table>
</fo:block>
<fo:block margin-top="10pt"/>
</xsl:template>
现在我想将第一行中的文本旋转90度,以便从下向上读取.
Now I want to rotate the text in the first row by 90 degrees so it is to be read from bottom up.
我想出的最佳解决方案是:
The best solution I came up with is to:
-
在
<fo:table>
上设置reference-orientation="0"
:
<fo:table border-style="solid" table-layout="fixed" reference-orientation="0">
用旋转90度的<fo:block-container>
将<fo:block>...</fo:block>
包围在<fo:table-cell>
内:
enclose the <fo:block>...</fo:block>
within the <fo:table-cell>
with a <fo:block-container>
rotated by 90 degrees:
<fo:table-cell border-style="solid">
<fo:block-container reference-orientation="90">
<fo:block><xsl:value-of select="." /></fo:block>
</fo:block-container>
</fo:table-cell>
文本是旋转的,但第一行的高度实际上为0,并且文本显示在表格上方,覆盖了先前的文本:
The text is rotate but the height of the first row is effectively 0 and the text is displayed above the table overlaying previous text:
在为第一行的单元格定义特定高度时,文本仍在表格之前而不是在第一行之内:
When defining a specific height for the cells of the first row, the text is still before the table and not within the first row:
如何将文本放置在第一行的单元格中,并根据行中最长的文本自动计算行的高度?
How can I position the text within the cells of the first row and have the height of the row computed automatically depending on the longest text within the row?
推荐答案
在表外显示文本:表单元格内的fo:block可能继承了封闭块中的设置,例如左边界.
Text displaying outside the table: the fo:block inside the table cell may be inheriting settings like a left margin from an enclosing block.
我以前从未见过的像元高度问题,在Antennahouse Formatter中,您可以旋转像元内容,并且IIRC可以适当地调整像元的大小.
The cell height problem I haven't seen before, in Antennahouse Formatter you can rotate cell content and IIRC the cell will be resized appropriately.
这篇关于表格单元格上方的表格单元格中的旋转文本不在其中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!