表格单元格中的旋转文本呈现在单元格上方而不在单元格内 [英] Rotated text in table cell rendered above cell not within

查看:52
本文介绍了表格单元格中的旋转文本呈现在单元格上方而不在单元格内的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下模板来生成定义的表:

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:

  • 上设置一个reference-orientation="0":

<fo:table border-style="solid" table-layout="fixed" reference-orientation="0">

  • ... 括在 旋转 90 度:

  • 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.

    这篇关于表格单元格中的旋转文本呈现在单元格上方而不在单元格内的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆