Page 1 of 1

Converting Microsoft .Docx to .txt

Posted: Wed Jan 16, 2008 11:28 pm
by Colin Wisbey
As I understand it, MS Office 2007 replaces .DOC format with .DOCX

I have a routine (per Enrico) to convert a .DOC file to a text file (.TXT) as follows:
-------
LOCAL oWord := CREATEOBJECT( "Word.Application" )
LOCAL oDoc := oWord:Documents:Open( "e:\xharbour\test.doc" )
oDoc:SaveAs( "e:\MyDir\NewDocument.txt", wdFormatDOSText )
oWord:Quit()
------
Works great.

I don't have Office 2007 so can anyone tell me what change I have to make to the above to programatically convert a .DOCX file to a text file (.TXT)?

TIA
Col

Posted: Thu Jan 17, 2008 8:11 am
by Otto
Not a real solution - more to see how word 2007 works:
rename docx to zip – open the zip file - search for document.xml – search for the <w:t>here is the TXT (</w:t>
Regards,
Otto

Posted: Thu Jan 17, 2008 8:19 am
by Otto
http://msdn2.microsoft.com/en-us/library/aa982683.aspx

How to: Manipulate Office Open XML Formats Documents