Xml ss:AutoFitHeight是否适用于文本?

Xml ss:AutoFitHeight是否适用于文本?,xml,excel,xslt,xls,Xml,Excel,Xslt,Xls,我有一个XML文件,保存为.xls,以便在Excel中使用: <results> <result> <companyName>Fnatic</companyName> <serviceID>1045</serviceID> <startDate>01-01-2014 00:00:00</startDate> <endDate

我有一个XML文件,保存为
.xls
,以便在Excel中使用:

<results>
    <result>
        <companyName>Fnatic</companyName>
        <serviceID>1045</serviceID>
        <startDate>01-01-2014 00:00:00</startDate>
        <endDate>01-02-2014 00:00:00</endDate>
        <hours>1</hours>
        <description>Couple of paragraphs of text. Like 3 of them.</description>
    </result>
    ... more results
</results>

删除列属性上的默认行高是违反直觉的,似乎与规范()相矛盾,但它有帮助

根据这个答案,这可能并不总是可能的:但是你应该检查一下参考资料:@helderdarocha这个问题是关于
ss:AutoFitWidth
ss:Column
。我也看到了参考资料,他们没有提到任何关于不支持“ss:Row”的
ss:AutoFitHeight
文本的内容。所以它应该会起作用。
... rest of typical declarations

<xsl:template match="results">  

    <Styles>
        <Style ss:ID="Default" ss:Name="Normal">
          <Alignment ss:Vertical="Top" />
          <Borders />
          <Font />
          <Interior />
          <NumberFormat />
          <Protection />
        </Style>
        <Style ss:ID="s1">
          <Font ss:Size="10" ss:Bold="1" />
          <Interior ss:Color="#cef2ce" ss:Pattern="Solid" />
          <Alignment ss:Horizontal="Right" ss:Vertical="Top" />
        </Style>
        <Style ss:ID="s2">
          <Interior ss:Color="#C0C0C0" ss:Pattern="Solid" />
        </Style>
      </Styles>


      <Worksheet ss:Name="Worksheet">
            <Table x:FullColumns="1" x:FullRows="1">
            <Column ss:Width="77" />
            <Column ss:Width="65" />
            <Column ss:Width="246" />
            <Column ss:Width="26" />
            <xsl:apply-templates select="result" />
            <Row><!-- Last Row -->
                <Cell ss:Index="3"><Data ss:Type="String">Total:</Data></Cell>
                <Cell ss:Formula="=SUM(R[-{count(result)}]C:R[-1]C)">
                    <Data ss:Type="Number"></Data>
                </Cell>
            </Row>
        </Table>
    </Worksheet>
</xsl:template>

<xsl:template match="result">
    <Row>
        <xsl:apply-templates select="serviceID" />
        <xsl:apply-templates select="hours" />
    </Row>
    <Row ss:AutoFitHeight="1">
        <xsl:apply-templates select="description" />
    </Row>
</xsl:template>

<xsl:template match="serviceID">
    <Cell ss:StyleID="s1">
        <Data ss:Type="String">Service ID:</Data>
    </Cell>
    <Cell ss:StyleID="s2">
        <Data ss:Type="Number">
            <xsl:value-of select="."/>
        </Data>
    </Cell>
</xsl:template>

<xsl:template match="description">
    <Cell ss:StyleID="s1">
        <Data ss:Type="String">Description:</Data>
    </Cell>
    <Cell ss:MergeAcross="2">
        <Data ss:Type="String">
            <xsl:value-of select="."/>
        </Data>
    </Cell>
</xsl:template>
<xsl:template match="hours">
    <Cell ss:StyleID="s1">
        <Data ss:Type="String">Hours:</Data>
    </Cell>
    <Cell ss:StyleID="s2">
        <Data ss:Type="Number">
            <xsl:value-of select="."/>
        </Data>
    </Cell>
</xsl:template>