Altova Mailing List Archives>Archive Index >microsoft.public.xml Archive Home >Recent entries >Thread Prev - Excel line breaks not working. [Thread Next] RE: Excel line breaks not working.To: NULL Date: 1/4/2006 12:43:00 PM After two days of working on this, I have found the answer and I hope this
helps others. The trick is to use the <xsl:text> tag with the
disable-ouput-escaping option set to "yes" and to use a [CData] section for
the new-line character as follows:
<Cell ss:StyleID="sHeaders">
<Data ss:Type="String">Contract<xsl:text
disable-output-escaping="yes"><![CDATA[ ]]></xsl:text>Value<xsl:text
disable-output-escaping="yes"><![CDATA[ ]]></xsl:text>($M)</Data></Cell>
for more information, visit these sites that I stumbled on:
http://xml.silmaril.ie/authors/html/
http://xml.silmaril.ie/authors/cdata/
"Leon Ford" wrote:
> I am doing an XSL transformation of a dataset (using a XmlDataDocument) to
> create an Excel XML file. Everything is working fine except that my header
> cells are not getting the line breaks like I want.
>
> When I explicitly format the headers in excel the way I want them and save
> the file as XML, the line built by excel is:
>
> <Cell ss:StyleID="sHeaders"><Data
> ss:Type="String">Contract
> Value
> ($M)</Data></Cell>
>
> In my XSL transformation file, I have the following line:
>
> <Cell ss:StyleID="sHeaders"><Data
> ss:Type="String">Contract
> Value
> ($M)</Data></Cell>
>
> When I do the transformation and save the XML file, the line produced is
> (note the line wrap):
>
> <Cell ss:StyleID="sHeaders"><Data ss:Type="String">Contract
> Value
> ($M)</Data></Cell>
>
> When this is loaded into excel, the linebreaks are gone and the cell text is
> all on the same line.
>
> I have tried putting in the <xsl:preserve-space elements="*"/> into my XSL
> transformation file, as well as XmlDataDocument.PreserveWhitespace = True
> prior to doing the transformation in my code. This does not help.
>
> The bottom line, is that I need the final XML file to be exactly as show
> below to have excel load this correctly.
>
> <Cell ss:StyleID="sHeaders"><Data
> ss:Type="String">Contract
> Value
> ($M)</Data></Cell>
>
>
> I am using Office 2003, Windows XP, and Visual Studio 2003.
>
| ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
