473,396 Members | 1,743 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

office word and c#

m.a
can I detect if word is installed at the user computer and if yes, which
version?

How can I write code to interact with a different version of word which is
not installed on my computer?

I can think of a solution such as (dummy code snippets)

object word =createobj("word.appliaction);

if (word != null) // word is installed

{

string version= word.GetVersion();

switch (version)

{

case "2000":

work_with_word_2000();

break;

case "2003":

word_with_word_2003();

break;

}

}

But how can I write this code in c#?

Any help is very appreciating.

Regards


Jun 27 '08 #1
2 1549
I did something similar for Office Outlook.

First, you'll probably need to drop a reference into your project. My
particular case used:
Microsoft.Office.Core, and
Outlook
Yours (Office Word) would differ somewhat.

In your includes, you'll need something like:
using Outlook = Microsoft.Office.Interop.Outlook;

I apologize for not mapping it out exactly, but I don't know exactly. I just
know what I did to get access to the Outlook application.

Other options might be looking at the registry keys or in the User's
Applications folder (C:\Documents and Settings\User9\Application
Data\Microsoft\Office).

Hope this information does some good!

"m.a" wrote:
can I detect if word is installed at the user computer and if yes, which
version?

How can I write code to interact with a different version of word which is
not installed on my computer?

I can think of a solution such as (dummy code snippets)

object word =createobj("word.appliaction);

if (word != null) // word is installed

{

string version= word.GetVersion();

switch (version)

{

case "2000":

work_with_word_2000();

break;

case "2003":

word_with_word_2003();

break;

}

}

But how can I write this code in c#?

Any help is very appreciating.

Regards


Jun 27 '08 #2
Hi M.a,
can I detect if word is installed at the user computer and if yes, which
version?
Inspect the Registry key HKCR\Word.Application

The CurVer key gives the current version installed (or, it multiple
versions are installed, the one that's considered to be "current" - usually
the newest). The CLSID key provides the GUID. If you search the GUID in the
Registry for its key you'll turn up more information, such as the *.exe
file location.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :-)

Jun 27 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Steve Drake | last post by:
All, I am trying to open a word document and get all the properties using .NET (c#), if I create the wordapp, call the correct methods I get invalid cast (see code examples), but if I create a...
1
by: zfeld | last post by:
1. Where do I get the Office 2003 PIAs? On the MSDN download site there are only downloads for XP office PIAs. Do they automatically get installed to the GAC with the installation of office 2003? ...
4
by: Richard | last post by:
Office Addins are easy in .NET. Try this from Visual Studio's main menu: File New Project "Other Projects" Extensibility Projects Shared Addin Run the wizard and you're off...
0
by: Karel | last post by:
Hi, I have developed a vb.net application to create a mail-merged document by using Automation to word from VB.NET. I added the following reference to the application: Microsoft Office 10.0...
2
by: William LaMartin | last post by:
I have created a program that allows for the automation of things in Word documents, like changing the values of DocVariables and the links to Excel Sheets. I did it using interoperoperatability,...
2
by: William LaMartin | last post by:
I have created a program that allows for the automation of things in Word documents, like changing the values of DocVariables and the links to Excel Sheets. I did it using interoperoperatability,...
1
by: R Reyes | last post by:
ISSUE (reposted) =========================== Can someone please explain to me why I can't get the MS Word Interop assembly to work in my VS2005 project? For many people, they say they add the...
4
by: Lyle Fairfield | last post by:
I asked this question in Microsoft.Public.Word two days ago but I have not received an answer. I believe there are Office Experts here who may be able to help. --------- "A friend has Office...
1
by: BK | last post by:
I have a .NET Solution (currently in 2003, FW 1.1) that uses Office automation for a few things (generates a Word document, dumps datagrids to Excel, etc.). One of my programmers works on the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.