[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now


vb.net and Microsoft word

Posted on 2011-09-13
Medium Priority
Last Modified: 2012-05-12
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.

Question by:rutledgj
  • 3
  • 3
  • 2
  • +2
LVL 83

Accepted Solution

CodeCruiser earned 1000 total points
ID: 36532540
If you want to use Word object model without Office, you would need something like this

LVL 40
ID: 36532559
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.
LVL 40
ID: 36532740
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.
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!


Author Comment

ID: 36533152
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.
LVL 40
ID: 36533706
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.

Expert Comment

ID: 36534626
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.

Expert Comment

ID: 36534757
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.

Author Comment

ID: 36535593
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.
LVL 70

Expert Comment

by:Éric Moreau
ID: 36535681
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.

Author Closing Comment

ID: 36718854
We are going to purchase the Aspose component.

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses
Course of the Month18 days, 23 hours left to enroll

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question