Marc Fisher
Posts: 11
Joined: 2005-05-21
|
Can someone give me a clue as to how I can get to the word object within and ItemSend procedure.
What I need to do is find out if word is the active editor, and if it is, I need to remove smarttags from the text.
In pseudo code
OnItemSend()
begin
if item.editor is wordeditor then
begin
objEditor := item.editor.object
objEditor.body.removesmarttags
end
end;
Any help would be appreciated
:-) |
|
Dmitry Kostochko
Add-in Express team
Posts: 2875
Joined: 2004-04-05
|
Hi Mark,
You have choosen the right way, see the code below. Please note the RemoveSmartTags method exists in the Word XP and Word 2003 Object Model only.
procedure TAddInModule.DoItemSend(ASender: TObject; const Item: IDispatch; var Cancel: WordBool);
var
IMail: _MailItem;
IDoc: _Document;
begin
IMail := nil;
if Assigned(Item) then
Item.QueryInterface(IID__MailItem, IMail);
if Assigned(IMail) then
try
if IMail.GetInspector.EditorType = olEditorWord then begin
IDoc := nil;
IMail.GetInspector.WordEditor.QueryInterface(IID__Document, IDoc);
if Assigned(IDoc) then
try
//...
//...
finally
IDoc := nil;
end;
end;
finally
IMail := nil;
end;
end;
|
|
Marc Fisher
Posts: 11
Joined: 2005-05-21
|
Thats great, thanks for the guidance. :)
Marc |
|