I am trying to create a table in XML format Spreadsheet 2003 (so that Excel can read it). I am writing a document using the XDocument class, and I need to get a new line in the body of one of the tags <Cell>. Excel, when it reads and writes, requires the files to have a literal string embedded in the string in order to correctly show the new row in the spreadsheet. He also writes it down as such.
The problem is that XDocument writes CR-LF (\ r \ n) when I have new lines in my data and it automatically accelerates ampersands for me when I try to do .Replace()in the input line, so I end up with &#10;in my a file that Excel simply happily writes out as a string literal.
Is there a way to get XDocument to write a literal as part of an XML stream? I know that I can do this by exiting from XmlTextWriter or literally just writing out a file using TextWriter, but I would prefer if not possible.
source
share