Re: Things that make me scream: xml:space="preserve" in WordML

It looks like you need to preserve the whitespace in the source WordML. I don’t know why you’re losing it in the first place, but if you just copy and paste to transform a part of WordML, then I guess you might lose the xml:space="preserve" that would otherwise preserve it. Just after you create the XmlDocument, before you actually load the XML, you need to set the PreserveWhitespace property on the XmlDocument object to true. Something like:

XmlDocument doc = new XmlDocument();
doc.PreserveWhitespace = true;
doc.Load(filename);

Reply

The content of this field is kept private and will not be shown publicly.