Roger Middlebrook
Guest
|
I would like to override the command FileOpen in Word. I have tried to do it with an adxBuiltInControl (BIC) but, for some reason, this makes Word think the Normal template has been modified.
I have tried BIC with and without an adxCommandBar and I use BuiltInID := 23.
This is Delphi 7 with ADX 2.5.0.254.
Am I taking the wrong approach? |
|
David Golden
Posts: 11
Joined: 2006-03-07
|
Rodger
Update to v2.6 of the VCL edition and see if that fixes the issue with the dirty template.
If that doesn't fix it, you can use something similar to the following code.
procedure TAddInModule.adxWordAppEventsDocumentBeforeClose(
ASender: TObject; const Doc: _Document; var Cancel: WordBool);
var
iX: Integer;
index: OleVariant;
begin
if not WordApp.NormalTemplate.Saved then
WordApp.NormalTemplate.Saved := True;
for iX := 1 to WordApp.Templates.Count do begin
index := iX;
if not WordApp.Templates.Item(index).Saved then
WordApp.Templates.Item(index).Saved := True;
end;
end;
Note. Some of that may be redundant, however I haven't had time to modify it.
Hope that helps
David Golden.
|
|
Roger Middlebrook
Guest
|
Thanks for this, David.
As it happens, the fault was in my code. I was handling the OnDocumentBeforeSave event (which is, of course, called when the Normal template is saved) and my handler was preventing the Normal template from being saved correctly.
Nothing to do with the BuiltInControl, not ADX's fault... all my fault.
|
|