Click here to Skip to main content
15,860,972 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have an XML file of a word document ,there am manually adding a set of line and saving it in notepad++. It is even getting saved and when i open that XML file in word the changes still there but if once i save the WORD document ,then the set of line which i have manually entered in the XML file disappers.

XML
<w:r>
<w:rPr>
<w:rFonts w:eastAsia="Times New Roman"/>
<w:bCs w:val="0"/>
<w:spacing w:val="5"/>
<w:shd w:val="clear" w:color="auto" w:fill="auto"/>
<w:lang w:val="en-US"/>
</w:rPr>
<w:note w:val="12" />     **// This is the line am adding manually**
<w:t>Document3 Purpose</w:t>
</w:r>

once if i open the XML in word and if i save it ,then these line's getting disappeared from corresponding words XML.
Posted
Comments
ZurdoDev 3-Jun-14 8:00am    
It sounds like you are manually adding them in a way not supported by Word. Any reason you don't do it through Word?
Member 10861307 3-Jun-14 8:19am    
if you go through this link you can understand
http://stackoverflow.com/questions/23989783/adding-invisible-texts-in-word

so i am trying to add the GUID here

1 solution

The element <w:note w:val="12" xmlns:w="#unknown" /> is probably mandatory in the element <w:r xmlns:w="#unknown"></w:r>. There probably is no handler for element <w:r xmlns:w="#unknown"></w:r> without the note element.

To make it more clear from the perspective of coding: The elements are mapped to internal classes. It looks for a class that is able to match with the data but there isn't a class with an optional note property. Because no matching class is found the complete element is discarded.

If they programmed it correctly, the element would simply be stored into somekind of UnknownElementContainerClass and when the document is saved it simply writes it back to the output file. Maybe another version of the software does know how to handle this element so should be preserved.

Hopefully you understand it somewhat better now. Because you broke of a piece of the key, it doesn't work with the lock you have. (But it could however work with another lock, but the lock doesn't "know").

Good luck!
 
Share this answer
 
Comments
Member 10861307 3-Jun-14 8:17am    
so how can we manually add elements to a XML? @E.FNijboer
E.F. Nijboer 16-Jun-14 6:06am    
Make a backup of the Word file. Try to add a note in the document and save it. Compare the xml files. There probably is something else needed. This way you might figure out what that is.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900