tags:

views:

40

answers:

2

Hi all, I want to convert the word document(.doc and .docx) to xml. How i can do this using php? After that i have to add some data in that xml file.

Anyone know please help me.

A: 

The best way to make an xml file via PHP is the XML DOM class.

http://www.w3schools.com/php/php_xml_dom.asp

codersarepeople
Thanks for reply, there in my website student will upload the word document and using php i want to add some date in that document. So for that i have to convert it to xml and then add data in xml.
Sachin
A: 

a word document (docx) is a xml file. simply unzip.

abel
Actually, it's a *bunch* of XML files. Simply unzipping can get messy...
Boldewyn
Thnks, but how to save it as xml so i can add some data in that. And also file may be .doc or .docx. then for .doc what to do?
Sachin
very true @Boldewyn. good if you just want the data. word/document.xml contains the data, but no formatting.
abel
http://stackoverflow.com/questions/3431544/how-to-prepare-a-word-2007-document-so-that-c-can-pull-data-out-of-it-semantical/3431609#3431609
abel
and check this out http://www.phplivedocx.org/
abel
I want file as it is in format only i want to add some data in the bottom of the file. so i will use it later.
Sachin
though i have never done it, you could add data to the word/document.xml and then zip it. or try phplivedocx.org
abel
Ok thanks i will try it.
Sachin