How do I load MS Word document (.doc and .docx) to memory (variable) without doing this?:
wordApp.Documents.Open
I don’t want to open MS Word, I just want that text inside.
You gave me answer for DOCX, but what about DOC? I want free and high performance solution – not to open 12.000 instances of Word to process all of them. 🙁 Aspose is commercial product, and 900$ is a way too much for what I do.
You can use wordconv.exe which is part of the Office Compatibility Pack to convert from doc to docx.
http://www.microsoft.com/downloads/details.aspx?familyid=941b3470-3ae9-4aee-8f43-c6bb74cd1466&displaylang=en
Just call the command like so: ‘C:\Program Files\Microsoft Office\Office12\wordconv.exe’ -oice -nme InputFile OutputFile
I’m not sure if you need word installed for it to run but it does work. I use it locally as a windows shell command to convert old office files to 2007 format whenever I want.