Posts 1 - 10 of 21
First | Prev. | 1 2 3 | Next | Last
|
|
Tamas Szabo
Posts: 28
Joined: 2008-07-03
|
Dear Developers,
I kindly ask you to help solve the problem below.
In MS Word 2007, I try to save locally a Word document in the onDocumentBeforeSave event of the TadxWordAppEvents component then I insert the file in the blob field of the database.
It doesn?Â?Ð?ét matter that the Cancel is True or False in the onDocumentBeforeSave event, I always get a message window from the Word with the text below:
?Â?Ð?ìSaving the autorecovery file is postponed?Â?Ð?í.
Is there any way to ban this message?
(Extra info: The displayalerts is set as None, and the error doesn?Â?Ð?ét occur in Word 2010.)
Waiting for your reply at your earliest convenience,
Tamas |
|
Posted 23 Jul, 2013 07:06:57
|
|
Top
|
|
Andrei Smolin
Add-in Express team
Posts: 18821
Joined: 2006-05-11
|
Hello Tamas,
Could you please check if an empty event procedure produces the issue?
Andrei Smolin
Add-in Express Team Leader |
|
Posted 23 Jul, 2013 07:42:57
|
|
Top
|
|
Tamas Szabo
Posts: 28
Joined: 2008-07-03
|
Hello Andrei,
I Can't see any empty events.
I tried to put down breakpoints on other events, (eg. Builtcontrol or Keyboardshorcut events)
but nothing happened, after onDocumentBeforeSave I get the message window ...
Tamas |
|
Posted 23 Jul, 2013 08:37:08
|
|
Top
|
|
Andrei Smolin
Add-in Express team
Posts: 18821
Joined: 2006-05-11
|
Hello Tamas,
I'm sorry for the confusion. I meant commenting out all code in the event procedure.
Andrei Smolin
Add-in Express Team Leader |
|
Posted 23 Jul, 2013 08:51:25
|
|
Top
|
|
Andrei Smolin
Add-in Express team
Posts: 18821
Joined: 2006-05-11
|
As far as I remember that sort of things occurs if you cancel the DocumentBeforeSave event. This is why I want you to check if the issue occurs without your code involved.
Andrei Smolin
Add-in Express Team Leader |
|
Posted 23 Jul, 2013 08:57:01
|
|
Top
|
|
Tamas Szabo
Posts: 28
Joined: 2008-07-03
|
Hello Andrei,
If I commented my code, I don't get the message, but I use the follwing code in event:
....
Doc.SaveAs(wOutFileName, wFileFormat, wLockComments, wPassword, wAddToRecentFiles, wWritePassword,
wReadOnlyRecommended, wEmbedTrueTypeFonts, wSaveNativePictureFormat, wSaveFormsData, wSaveAsAOCELetter);
InsertFileToDb(wOutFileName,...);
...
Doc.Saved := True;
Cancel := True;
...
If I replace "Cancel := True;" to "Cancel := False;", or "Doc.Saved :=False;"
I get the message window also...
In Word 2010 it's working. Can I save the Document on other way?
Tamas |
|
Posted 23 Jul, 2013 09:31:39
|
|
Top
|
|
Andrei Smolin
Add-in Express team
Posts: 18821
Joined: 2006-05-11
|
Hello Tamas,
I suppose your code is executed when Word performs AutoSave. I'd recommend checking if the event was generated by the user action first. To do this, you can intercept all Ribbon controls which generate this event or result in generating it and set a flag in the event handlers; if the flag is not set in BeforeDocumentSave, then the event is caused by Word itself and you don't need to cancel it.
Andrei Smolin
Add-in Express Team Leader |
|
Posted 23 Jul, 2013 10:09:21
|
|
Top
|
|
Tamas Szabo
Posts: 28
Joined: 2008-07-03
|
Hello Andrei,
"procedure TAddInModule.adxWordAppEvents1DocumentBeforeSave(ASender: TObject;
const Doc: _Document; var SaveAsUI, Cancel: WordBool);
"
I noticed that this flag is achieved by the "SaveAsUI", and I use this parameter.
But even if I set Cancel to False, I still get the message.
Tamas |
|
Posted 23 Jul, 2013 12:12:20
|
|
Top
|
|
Andrei Smolin
Add-in Express team
Posts: 18821
Joined: 2006-05-11
|
Hello Tamas,
I cannot reproduce the issue in word 2007 SP3 using this add-in:
uses
... Word2000, Math, Windows;
...
procedure TAddInModule.adxWordAppEvents1DocumentBeforeSave(
ASender: TObject; const Doc: _Document; var SaveAsUI, Cancel: WordBool);
var
wOutFileName: OLEVariant;
begin
OutputDebugString('!!! adxWordAppEvents1DocumentBeforeSave');
wOutFileName := 'd:FileName' + IntToStr(RandomRange(0, 1000));
OutputDebugString('!!! before SaveAs');
Doc.SaveAs(wOutFileName, EmptyParam, EmptyParam, EmptyParam, EmptyParam, EmptyParam,
EmptyParam, EmptyParam, EmptyParam, EmptyParam, EmptyParam);
Cancel := True;
OutputDebugString('!!! adxWordAppEvents1DocumentBeforeSave exit');
end;
Andrei Smolin
Add-in Express Team Leader |
|
Posted 24 Jul, 2013 06:32:55
|
|
Top
|
|
Tamas Szabo
Posts: 28
Joined: 2008-07-03
|
Hello Andrei,
I created a new empty com-addin project, in that I used your code,
(repl ace debug to cndebugger.logmsg)
registered my dll in word,
set the Autorecovery in Word to 1 min.
I saved normally the document, and I put the text 'a', and I waited for autosave.
After 1 min. the document saved, and
the message window presented :-(((
Extra info:
OS: Win7 32bit.
MsWord 2007 SP3
Delphi 7
Addin Expr. 7.2.1212 premium
Best regards,
Tamas |
|
Posted 24 Jul, 2013 10:38:18
|
|
Top
|
|
Posts 1 - 10 of 21
First | Prev. | 1 2 3 | Next | Last
|