I am working on a Document Generation System, where I have a Microsoft Office AddIn where we write the templates. I have the following code which reads the WordML of the currently active document:-
Range range = currentDocument.Range(currentDocument.Content.Start, currentDocument.Content.End); string contentXml = range.get_XML(false);
When the active document becomes large, the above method (get_XML) returns WordML which is not correct and is missing all the styling and formatting information from the paragraphs (w:p). It returns the following WordML (just a fragment):-
<w:body><w:p wsp:rsidR="00955A37" wsp:rsidRPr="00955A37" wsp:rsidRDefault="00955A37" wsp:rsidP="00955A37"><w:r wsp:rsidRPr="00955A37"><w:t>{CLAUSE#:BEGIN:445:LeaseAgreement1_FirstPageV1 (1.3):#CLAUSE}</w:t></w:r></w:p>
Instead of the following which is the correct Word ML:-
<w:body><w:p wsp:rsidR="00C37628" wsp:rsidRPr="00092474" wsp:rsidRDefault="00C37628" wsp:rsidP="00C37628"><w:pPr><w:widowControl w:val="off" /><w:autoSpaceDE w:val="off" /><w:autoSpaceDN w:val="off" /><w:adjustRightInd w:val="off" /><w:spacing w:after="0" w:line="240" w:line-rule="auto" /><w:jc w:val="both" /><w:rPr><w:rFonts w:ascii="Times New Roman" w:fareast="Times New Roman" w:h-ansi="Times New Roman" /><wx:font wx:val="Times New Roman" /><w:b /><w:b-cs /><w:color w:val="0000FF" /><w:sz w:val="24" /><w:sz-cs w:val="24" /><w:lang w:val="EN-AU" /></w:rPr></w:pPr><w:r wsp:rsidRPr="00092474"><w:rPr><w:rFonts w:ascii="Times New Roman" w:fareast="Times New Roman" w:h-ansi="Times New Roman" /><wx:font wx:val="Times New Roman" /><w:b /><w:b-cs /><w:color w:val="0000FF" /><w:sz w:val="24" /><w:sz-cs w:val="24" /><w:lang w:val="EN-AU" /></w:rPr><w:t>{CLAUSE#:BEGIN:445:LeaseAgreement1_FirstPageV1 (1.3):#CLAUSE}</w:t></w:r></w:p>Why is the styling information absent from the returned Word ML using the above method when the document becomes large?