开发者

XSL Transform Not Recognizing char(10) for excel

开发者 https://www.devze.com 2023-04-12 14:06 出处:网络
I am using xsl transform to take xml data and create an xml file that can be read by excel.I originally created and xls template file from and excel file I wanted my data to look like.In some of the c

I am using xsl transform to take xml data and create an xml file that can be read by excel. I originally created and xls template file from and excel file I wanted my data to look like. In some of the cells users use Alt Enter for new lines in a cell and I want to be able to do this in the transform.

So, I have in part of my template data file some entries like this:

<Code>28890&#10;&#10;&#10;12345</Code>

In the template file, I am doing this:

<Cell><Data ss:Type="String"><xsl:value-of select="Code"/></Data></Cell>

But when I do the transform to xml, the resulting document, when opened in excel, doesn't recognize the alt enter, so the cells do not have multiple lines.

Any help would be greatly appreciated, I am new to this, so if ther开发者_开发知识库e is a better way I would like to know.

Thanks


I did disocver the answer, and it is the transform xslt. I changed this:

<Cell><Data ss:Type="String"><xsl:value-of select="Code"/></Data></Cell> 

To this:

<Cell><Data ss:Type="String"><xsl:value-of disable-output-escaping="yes" select="Code"/></Data></Cell> 

and my data to use the following for the alt+enter key:

&amp;#10;

Now just need to figure out how to get the cell to auto expand.


As far as the auto expand, just had to add a style to the cell that forces word wrap:

<Style ss:ID="CPTCodeStyle">
      <Alignment ss:Horizontal="Center" ss:Vertical="Top" **ss:WrapText="1"**/>
      <Font ss:FontName="Verdana" x:Family="Swiss" ss:Size="12" ss:Bold="1"/>
      <NumberFormat ss:Format="@"/>
    </Style>
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号