Office Interop Word Range.getXml(false) returning incorrect xml of the active document



I am working on an existing VSTO Project which is fetching the Xml of the active document using the following code:



object oMissing = System.Reflection.Missing.Value;
Document currentDocument = CAEGenieCommon.GenieEnvironment.CurrentDocument;
Range range = currentDocument.Range(ref oMissing, ref oMissing);
string contentXml = range.get_XML(false);


First, I can't find this method in the Range object on msdn in any version:


http://ift.tt/11Bp316


Second, this is not returning the correct xml of the active document, if the document is very large. When the document is large, it is missing the formatting/styling information from the paragraphs in the returned Xml.


No comments:

Post a Comment