Converting Microsoft .Docx to .txt

Post Reply
Colin Wisbey
Posts: 56
Joined: Mon Jul 03, 2006 2:34 am

Converting Microsoft .Docx to .txt

Post 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
User avatar
Otto
Posts: 4470
Joined: Fri Oct 07, 2005 7:07 pm
Contact:

Post 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
User avatar
Otto
Posts: 4470
Joined: Fri Oct 07, 2005 7:07 pm
Contact:

Post by Otto »

http://msdn2.microsoft.com/en-us/library/aa982683.aspx

How to: Manipulate Office Open XML Formats Documents
Post Reply