473,324 Members | 2,246 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,324 software developers and data experts.

com interop problem

hi,
i am able to display ms-word spell check utility on my form by minimizing
the word document. but the spell check utilty appears in the background. it
appears as a modal dialog.

Q1. how do i make it appear on the foreground.

Q2. it has some painting problems. when i move the spell check window around
my form window doesnt paint properly.
Q3. i used the following approach to display ms-word spell checker in my
app. the reason is that i want it to work with atleast the recent versions
of word (2002 and 2003). is there a better approach than this?
I dont want to add a reference to my app because that reference will point
to only one version of office. and i want my app to work with 2002 and 2003.
i dont know what version my clients may have.
i create interfaces like so

[Guid("0002096B-0000-0000-C000-000000000046"),
InterfaceType(ComInterfaceType.InterfaceIsIDispatc h)]
interface _Document
{
[DispId(0x0000002a)]
_Window ActiveWindow
{
get;
}

[DispId(0x00000451)]
void Close(object saveChanges, object originalFormat, object
routeDocument);

[DispId(0x00000084)]
void CheckSpelling(object CustomDictionary,object IgnoreUppercase,object
AlwaysSuggest,object CustomDictionary2,object CustomDictionary3,object
CustomDictionary4,object CustomDictionary5,object CustomDictionary6,object
CustomDictionary7,object CustomDictionary8, object CustomDictionary9, object
CustomDictionary10);
}

similarly i have _Application interface and _Documents interfaces and so on
...
and then i simply call this

public static string CheckSpelling(string text)
{
Type type = Type.GetTypeFromProgID("Word.Application");
object wordApplication = Activator.CreateInstance(type);
app = (_Application)wordApplication;

_Document doc;
_Documents docs = (_Documents)app.Documents;
doc = docs.Add(Missing.Value, Missing.Value, Missing.Value, true);
doc.ActiveWindow.WindowState = WdWindowState.wdWindowStateMinimize;
app.Selection.Text = text;

doc.CheckSpelling(Missing.Value, Missing.Value, Missing.Value,
Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value,
Missing.Value, Missing.Value, Missing.Value, Missing.Value);
doc.ActiveWindow.Selection.WholeStory();
newText = doc.ActiveWindow.Selection.Text;

app.Visible = false;
doc.Close(false, Missing.Value, Missing.Value);
doc = null;
}

thnx.
Nov 16 '05 #1
0 988

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

Similar topics

1
by: Nadav | last post by:
Hi, Introduction *************** I have a system build of a collection of 'Native COM objects' and '.NET COM interop' objects, all of the COM objects are managed through a 'Native COM' layer,...
20
by: Razzie | last post by:
Hey all, I'm really going through a small hell right now - I've completely lost it :) I made a project, using two interop libraries from exchange (created them as in this msdn article:...
1
by: Shiro | last post by:
Hi I have read the various postings relating to Interop strong name signing and cannot find an example similar to mine. I have stringly named my AxInterops/Interops and they all work just...
8
by: Rob Edwards | last post by:
When trying to add the Microsoft CDO for Exchange Management Library (aka CDOEXM.dll) I receive the following message: "A reference to 'Microsoft CDO for Exchange Management Library' could not be...
7
by: R Reyes | last post by:
Can someone please explain to me why I can't get the MS Word Interop assembly to work in my VS2005 project? I'm trying to manipulate MS Word from my Web Form application and I can't get passed...
3
by: Hospital S.Sebastiao | last post by:
Hi, i'm in desperate need of help to fix a problem that i have, the problem is the following: I have an ASP.NET aplication that to open an word template document, this aplication is in C#(using...
2
by: JC | last post by:
Anybody knows what problem has this code? I think, in the Garbage Collector? You know the Solution? The program in the test's case, whit 350 contacts, run OK before number 86. The error is a...
1
by: Don.Leri | last post by:
Hi, I have a logger.dll (unmanaged c++ dll compiled in vs2005). I have a C# interop to use that dll in managed code implemented in Interfaces.dll (used by other C# dlls). I also have a...
1
by: allbelonging | last post by:
C#.Net Outlook 2003 automation (programmatically) with Office.Interop.Outlook Problem: I have my outlook 2003 configured with multiple mailbox on my local machine. I want to specify the mailbox...
0
by: Tina | last post by:
I've gotten this before where it says there is a problem with Interop.MSDASC but I can't remember what causes this. This is a 1.1 app I'm trying to debug in vs2005. It was running yesterday just...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.