I have a fragment of Open XML document from a Word 2007 DOCX document like the following:
<w:p w:rsidR="00000000" w:rsidRDefault="00A50201">
<w:pPr>
<w:keepNext />
<w:keepLines />
<w:tabs>
<w:tab w:val="left" w:pos="2160" />
</w:tabs>
<w:suppressAutoHyphens />
<w:adjustRightInd />
<w:spacing w:line="300" w:lineRule="auto" />
<w:rPr>
<w:lang w:val="en-GB" />
</w:rPr>
</w:pPr>
<w:r>
<w:rPr>
<w:lang w:val="en-GB" />
</w:rPr>
<w:t>Name:</w:t>
</w:r>
<w:r>
<w:rPr>
<w:lang w:val="en-GB" />
</w:rPr>
<w:tab />
</w:r>
<w:r>
<w:t>|EE_NAME|</w:t>
</w:r>
</w:p>
This fragment has been loaded into memory as a string from the database. But I can’t figure out a correct solution to edit or process it for having the following issues:
- Aspose.Words doesn’t provide any of API that takes a string parameter to process the WordML fragment.
- I have tried to use MemoryStream to load that fragment WordML string, but getting the “Unsupported FileFormat Exception” with “Unknown file format.” error message.
- I have also tried to create a separate xml file with the above WordML fragment, but still gets the same UnsupportedFileFormatException when trying to create the document using the file.
I also tried the other fragment of WordML text as follow, but still got the same problems:
<w:p w:rsidR="00000000" w:rsidRDefault="00A50201">
<w:pPr>
<w:keepNext />
<w:keepLines/>
<w:widowControl />
<w:suppressAutoHyphens/>
<w:rPr>
<w:lang w:val="en-GB"/>
</w:rPr>
</w:pPr>
<w:r>
<w:rPr>
<w:lang w:val="en-GB" />
</w:rPr>
<w:t>
If you choose to receive a deferred
pension, y
</w:t>
</w:r>
<w:r>
<w:rPr>
<w:lang w:val="en-GB" />
</w:rPr>
<w:t>
ou should be aware of the
following.
</w:t>
</w:r>
</w:p>
<w:p w:rsidR="00000000" w:rsidRDefault="00A50201">
<w:pPr>
<w:keepNext />
<w:keepLines />
<w:suppressAutoHyphens />
<w:adjustRightInd />
<w:rPr>
<w:lang w:val="en-GB" />
</w:rPr>
</w:pPr>
</w:p>
Does anyone have any thoughts of this issue?
Besides the above problem, I am also looking for a solution that can take this WordML fragment to display into a RichText editor (i.e. Html editor or any WYSIWYG editor) that can let user further edit the text and save the change. (similar to copy a portion from a Word DOCX document and paste to another rich text editor to edit). Any ideas for this will be very appreciated!