Excel XML Newline in Cell
        Posted  
        
            by spasarto
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by spasarto
        
        
        
        Published on 2010-05-26T20:10:50Z
        Indexed on 
            2010/05/26
            21:11 UTC
        
        
        Read the original article
        Hit count: 291
        
I am using LINQ to XML to create an Excel XML file. I want to include newlines within the cells. Excel uses the 
 literal to represent a new line. If I try to add this using an XText:
XText newlineElement = new XText( "Foo
Bar" );
I get:
Foo
Bar
Which shows up in Excel as:
Foo
Bar
Is there a way to write 
 to the XML file without doing a 
String.Replace( "
", "
" )
over the resulting file text?
© Stack Overflow or respective owner