Solved

vb.net and Microsoft word

Posted on 2011-09-13
10
270 Views
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.

Thanks.
0
Comment
Question by:rutledgj
  • 3
  • 3
  • 2
  • +2
10 Comments
 
LVL 83

Accepted Solution

by:
CodeCruiser earned 250 total points
Comment Utility
If you want to use Word object model without Office, you would need something like this

http://www.aspose.com/categories/.net-components/aspose.words-for-.net/default.aspx
0
 
LVL 40

Expert Comment

by:Jacques Bourgeois (James Burger)
Comment Utility
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.
0
 
LVL 40

Expert Comment

by:Jacques Bourgeois (James Burger)
Comment Utility
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.
0
 

Author Comment

by:rutledgj
Comment Utility
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.
0
 
LVL 40

Expert Comment

by:Jacques Bourgeois (James Burger)
Comment Utility
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.
0
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 
LVL 4

Expert Comment

by:Pacemaker9007
Comment Utility
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.
0
 
LVL 4

Expert Comment

by:Pacemaker9007
Comment Utility
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.
0
 

Author Comment

by:rutledgj
Comment Utility
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.
0
 
LVL 69

Expert Comment

by:Éric Moreau
Comment Utility
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.
0
 

Author Closing Comment

by:rutledgj
Comment Utility
We are going to purchase the Aspose component.
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Article by: jpaulino
XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String (http://msdn.microsoft.com/en-us/library/system.string.aspx) Literal, only instead of starting and ending with w…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

728 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now