Link to home
Start Free TrialLog in
Avatar of rutledgj
rutledgj

asked on

vb.net and Microsoft word

I am writing a windows app that simply needs to open a word doc and do a saveas .txt file to preserve the auto numbering used in the document.

My question is what dlls would I have to copy with the exe to make use of the word object?  The app will run on a server that is part of a cluster. We don't want to install office or the complete office pias.

Also, where can I find the needed dlls on my local machine to copy them over.

Thanks.
ASKER CERTIFIED SOLUTION
Avatar of Nasir Razzaq
Nasir Razzaq
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
The dll you are talking about is called an Interop. It is offered as an option when you install Visual Studio or Word (version 2003 and on) on a computer. And you are not allowed to distribute it, since the user must have a Word licence in order to use Word.

A little different in Visual Studio 2010, with the framework 4.0, where you have the option of incorporating the necessary parts of the dll into the application.

Anyway, the dll is nothing, it is just a bridge to Word from .NET. Word works from its .exe, not from a dll. In order to use Word with any application (.NET, VB6, VBA, script, you name it), Word has to be installed on the computer on which the application is running.

You will have to fish the Internet to try to find if there is a tool that could make the conversion from .doc to .txt.
I really like the "like" in "like this" in CodeCruiser link :-)

... for the price of 3 Word standalone licences (for something that needs to work on a server so one Word licence would be enough), bigger than Winword.exe, and at first glance, it converts between word processor formats, not .txt.

But CodeCruiser is right, you need something like this. You might want to try at www.ComponentSource.com. When it exists, usually they have it.
Avatar of rutledgj
rutledgj

ASKER

I'm confused I guess. I thought there was a way to just copy/paste the exe and needed dlls. I am using vs 2010 if that matters but we operate on office 2007. Surely thhere is a way without purchasing a third party component.
You cannot only copy the .exe. It needs to be installed, and you need a proper license to install it.

As for the interop (the dll), now that we know that you are in VS2010, I can tell you about this new wonderful little feature of the 2010 version.

Reference Word as you would any other dll from the COM tab of the Reference window.

The following should be set by default, but just check to make sure. Once the reference is done, click on the reference in the list of active references. In the Properties window, the Embed Interop Types property should be set to True.

With this option set, no need to distribute the dll. The code for the classes you use in your application, and only for those classes, will be embedded in your application. It will be part of your .exe.

But Word still needs to be installed on the computer that runs the application.
If you only need the text, you can extract it, try e.g. this http://www.codeproject.com/KB/office/ExtractTextFromDOCXs.aspx

Otherwise I agree with JamesBurger, it is not a question of coying dlls or exe files, but a question of a valid Word license. You will only need one for a server, so it is not very expensive.
You can also try this http://bytescout.com/products/developer/documentsdk/index.html, it is a free beta, unfortunately I have not tried it so I cannot give you any details.
Thanks. It isn't that we don't want to buy Word, We do have many copies of it. They just don't want to install it on a clustered server.  I'll check some of the other suggestions and get back.
I am not sure but maybe OpenXML can be used to do that. Start with http://www.emoreau.com/Entries/Articles/2011/03/Using-OpenXML-to-fill-a-Word-document-from-a-Net-application.aspx

But I would definitely go with Aspose. I use it in many projects and it is the way to go.
We are going to purchase the Aspose component.