Click here to Skip to main content
15,881,172 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
Hi...i want to convert docx to custom xml document, but before converting in to custom xml, docx/doc should in to word 2003 xml document, which is single xml file having root element called word document..i am trying so hard to convert these document using c++, but all my attempts are failing, i tried to convert document in to rtf and then converting to xml but end of the day it s not working..is there any third party lib file to convert docx to 2003 xml document??..suggestions and help is greatly appreciated


regards
krishnaprasad
Posted
Comments
Sergey Alexandrovich Kryukov 26-Aug-14 3:06am    
Not clear. DOCX is already XML. Which XML?
What have you tried so far?
—SA
krishnaprasad t 26-Aug-14 3:19am    
yes..docx is already xml, when we zip the document and make archive we can see the individual xml files like document.xml, header.xml etc..all these files are packed in opc(open packing convention)..i need to convert document in to single word 2003 xml document..in office we have option as save as(.xml).

example:

<w:worddocument xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xml:space="preserve" w:embeddedobjpresent="no"><o:documentproperties xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0"><o:title><o:subject><o:keywords><o:description><o:category><o:author><o:lastauthor><o:manager><o:company><o:hyperlinkbase><o:revision><o:totaltime><o:lastprinted><o:created>2014-08-24T04:12:27.080894102Z<o:lastsaved>2014-08-24T04:25:29.676014144Z<o:pages>1<o:words>4<o:characters>23<o:paragraphs>1<o:customdocumentproperties xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0"><o:editor dt:dt="string">LibreOffice/4.2.4.2$Linux_x86 LibreOffice_project/420m0$Build-2<o:language dt:dt="string"><w:fonts><w:defaultfonts w:ascii="" w:h-ansi="" w:fareast="" w:cs=""><w:font w:name="FreeSans1"><w:family w:val="Swiss"><w:pitch w:val=""><w:font w:name="Liberation Serif"><w:family w:val="Roman"><w:pitch w:val="variable"><w:font w:name="Liberation Sans"><w:family w:val="Swiss"><w:pitch w:val="variable"><w:font w:name="Droid Sans"><w:family w:val="System"><w:pitch w:val="variable"><w:font w:name="FreeSans"><w:family w:val="System"><w:pitch w:val="variable"><w:lists xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0"><w:listdef w:listdefid="0"><w:lvl w:ilvl="0"><w:start w:val="1"><w:nfc w:val="255"><w:lvltext w:val="%1"><w:lvljc w:val="left"><w:suff w:val="Nothing"><w:lvl w:ilvl="1"><w:start w:val="1"><w:nfc w:val="255"><w:lvltext w:val="%2"><w:lvljc w:val="left"><w:suff w:val="Nothing"><w:lvl w:ilvl="2"><w:start w:val="1"><w:nfc w:val="255"><w:lvltext w:val="%3"><w:lvljc w:val="left"><w:suff w:val="Nothing"><w:lvl w:ilvl="3"><w:start w:val="1"><w:nfc w:val="255"><w:lvltext w:val="%4"><w:lvljc w:val="left"><w:suff w:val="Nothing"><w:lvl w:ilvl="4"><w:start w:val="1"><w:nfc w:val="255"><w:lvltext w:val="%5"><w:lvljc w:val="left"><w:suff w:val="Nothing"><w:lvl w:ilvl="5"><w:start w:val="1"><w:nfc w:val="255"><w:lvltext w:val="%6"><w:lvljc w:val="left"><w:suff w:val="Nothing"><w:lvl w:ilvl="6"><w:start w:val="1"><w:nfc w:val="255"><w:lvltext w:val="%7"><w:lvljc w:val="left"><w:suff w:val="Nothing"><w:lvl w:ilvl="7"><w:start w:val="1"><w:nfc w:val="255"><w:lvltext w:val="%8"><w:lvljc w:val="left"><w:suff w:val="Nothing"><w:lvl w:ilvl="8"><w:start w:val="1"><w:nfc w:val="255"><w:lvltext w:val="%9"><w:lvljc w:val="left"><w:suff w:val="Nothing"><w:list w:ilfo="1"><w:ilst w:val="0"><w:styles><w:style w:styleid="default-paragraph-style" w:type="paragraph" w:default="on"><w:name w:val="default-paragraph-style"><w:ppr xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0"><w:adjustrightind w:val="off"><w:spacing><w:ind><w:widowcontrol w:val="off"><w:pbdr><w:ind>
krishnaprasad t 26-Aug-14 3:23am    
<w:worddocument xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xml:space="preserve" w:embeddedobjpresent="no"><o:documentproperties xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0"><o:title><o:subject><o:keywords><o:description><o:category><o:author><o:lastauthor><o:manager><o:company><o:hyperlinkbase><o:revision><o:totaltime><o:lastprinted><o:created>2014-08-24T04:12:27.080894102Z<o:lastsaved>2014-08-24T04:25:29.676014144Z<o:pages>1<o:words>4<o:characters>23<o:paragraphs>1<o:customdocumentproperties xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0"><o:editor dt:dt="string">LibreOffice/4.2.4.2$Linux_x86 LibreOffice_project/420m0$Build-2<o:language dt:dt="string"><w:fonts><w:defaultfonts w:ascii="" w:h-ansi="" w:fareast="" w:cs=""><w:font w:name="FreeSans1"><w:family w:val="Swiss"><w:pitch w:val=""><w:font w:name="Liberation Serif"><w:family w:val="Roman"><w:pitch w:val="variable"><w:font w:name="Liberation Sans"><w:family w:val="Swiss"><w:pitch w:val="variable"><w:font w:name="Droid Sans"><w:family w:val="System"><w:pitch w:val="variable"><w:font w:name="FreeSans"><w:family w:val="System"><w:pitch w:val="variable"><w:lists xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0"><w:listdef w:listdefid="0"><w:lvl w:ilvl="0"><w:start w:val="1"><w:nfc w:val="255"><w:lvltext w:val="%1"><w:lvljc w:val="left"><w:suff w:val="Nothing"><w:lvl w:ilvl="1"><w:start w:val="1"><w:nfc w:val="255"><w:lvltext w:val="%2"><w:lvljc w:val="left"><w:suff w:val="Nothing"><w:lvl w:ilvl="2"><w:start w:val="1"><w:nfc w:val="255"><w:lvltext w:val="%3"><w:lvljc w:val="left"><w:suff w:val="Nothing"><w:lvl w:ilvl="3"><w:start w:val="1"><w:nfc w:val="255"><w:lvltext w:val="%4"><w:lvljc w:val="left"><w:suff w:val="Nothing"><w:lvl w:ilvl="4"><w:start w:val="1"><w:nfc w:val="255"><w:lvltext w:val="%5"><w:lvljc w:val="left"><w:suff w:val="Nothing"><w:lvl w:ilvl="5"><w:start w:val="1"><w:nfc w:val="255"><w:lvltext w:val="%6"><w:lvljc w:val="left"><w:suff w:val="Nothing"><w:lvl w:ilvl="6"><w:start w:val="1"><w:nfc w:val="255"><w:lvltext w:val="%7"><w:lvljc w:val="left"><w:suff w:val="Nothing"><w:lvl w:ilvl="7"><w:start w:val="1"><w:nfc w:val="255"><w:lvltext w:val="%8"><w:lvljc w:val="left"><w:suff w:val="Nothing"><w:lvl w:ilvl="8"><w:start w:val="1"><w:nfc w:val="255"><w:lvltext w:val="%9"><w:lvljc w:val="left"><w:suff w:val="Nothing"><w:list w:ilfo="1"><w:ilst w:val="0"><w:styles><w:style w:styleid="default-paragraph-style" w:type="paragraph" w:default="on"><w:name w:val="default-paragraph-style"><w:ppr xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0"><w:adjustrightind w:val="off"><w:spacing><w:ind><w:widowcontrol w:val="off"><w:pbdr><w:ind><w:rpr xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0"><w:rfonts w:ascii="Liberation Serif" w:h-ansi="Liberation Serif" w:fareast="Droid Sans" w:cs="FreeSans"><w:sz w:val="24"><w:lang w:val="en-IN"><w:style w:styleid="default-table-style" w:type="table" w:default="on"><w:name w:val="default-table-style"><w:tblpr>
Sergey Alexandrovich Kryukov 26-Aug-14 3:24am    
Yes, LibreOffice code is one of the ways of doing such things. For DOCX (but not DOC), one alternative is using Microsoft Open XML SDK.
—SA
krishnaprasad t 26-Aug-14 3:29am    
thank you sergey..even i have tried with microsoft open xml sdk but it will generate code in C#..i want to implement these module using c++..i have tried by using libre office source code, it has module called writer and sw..but those modules have so many dependencies.

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