Adx in Word making templates "dirty"

Add-in Express™ Support Service
That's what is more important than anything else

Adx in Word making templates "dirty"
 
David Golden




Posts: 11
Joined: 2006-03-07
Hello again all,

I just wanto that you guys especially Dmitry for all the help so far with your products, I've been loving the Application event components, very cool.

Anyway, I've been having an issue with my Add-in causing any templates used when creating a document to become "dirty" or unsaved. Sometimes this also includes the normal template, but its usually another template being used with any document.

I noticed there was a topic in this regard in the .NET area of the forums however after a few goes at trying to make some of the solutions there work in VCL I haven't been able to get my Add-in to stop making the template unsaved.

My other is a bit strange, I've created a form that bybasses (when asked to) the Insert Hyperlink function in Office products, however a strange thing happens when I insert a hyperlink on a Autoshape. I get my normal form, but once the hyperlink is inserted onto the Autoshape, it then loops back and pops my form back up asking to insert another hyperlink.

I'm not sure if this will help but it seems to go back to the TadxEventSink.Invoke in adxAddIn about line 1841.

Any ideas? Thanks.
Posted 25 Apr, 2006 17:38:51 Top
Lukas Zweckmayr




Posts: 27
Joined: 2004-10-22
hi,

i can only help you with your first question, following code does the right thing:

procedure TAddInModule.adxWordAppEventsDocumentBeforeSave(ASender: TObject;
const Doc: _Document; var SaveAsUI, Cancel: WordBool);
var
templ: Template;
begin
templ := IDispatch(Doc.Get_AttachedTemplate()) as Template;
try
if (templ <> nil) then templ.Saved := true;
except
end;
end;

hth
Posted 26 Apr, 2006 02:59:22 Top
Dmitry Kostochko


Add-in Express team


Posts: 2875
Joined: 2004-04-05
Hi David,

As to the first problem: MS Word stores all changes related to UI in its templates. Normally they are stored in the normal.dot template. You can use a code similar to the one above to save all changes in templates.

As to the second problem: I think there could be various reasons. Please send me your project (or some test project with the same behavior) for testing. Then I will try to detect the real cause.

Posted 26 Apr, 2006 08:51:43 Top