 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Bryan Thorell Guest
|
Posted: Fri Apr 22, 2005 8:31 pm Post subject: Word updates database on save.... |
|
|
Hi, I'm hoping someone can give me a clue here...
I'm working on an application that automates Word to do a Mail Merge,
which comes up with a new document which the user can then modify
before printing.
At the point the document is closed, I would like to take that
document (merged/edited) and save it as a blob back into the database
(or write it out as a file)
I can grab the "Merged" document and save it to a file after it is
merged, but how can I make word save changes to my file when the
document is closed? I have noticed that in D7 there are the Word
servers which contain an OnClose for the Document, but the application
I am using is creating the Word application as a variant and I can't
seem to set the OnClose like: WordDoc.OnClose := procedure, it's
saying I don't have enough parameters???
Any help will be greatly appreciated.
Example Below:
var
WordApp, WordDoc : variant;
MergedDoc : variant;
WordApp := CreateOLEObject('Word.Application');
WordDoc := WordApp.Documents.Add(Template := aTemplateFN);
WordDoc.MailMerge.Execute;
Application.ProcessMessages;
MergedDoc := WordApp.ActiveDocument;
MergedDoc is the document that is created after the merge process,
this is what I want to make sure I save (with any changes).
Bryan Thorell
|
|
| Back to top |
|
 |
George Birbilis Guest
|
Posted: Sun Apr 24, 2005 10:55 am Post subject: Re: Word updates database on save.... |
|
|
a word server object of Delphi can connect to existing instance of Word, so
you can keep your code and also connect such an object to that word instance
to get back events (if you have many word instances running you'll have a
problem with this strategy though)
with the variant you have to use connection points etc. I think
http://www.gekko-software.nl/Delphi/art10.htm
might help
--
-----
George Birbilis (birbilis (AT) kagi (DOT) com)
Microsoft Most Valuable Professional
MVP J# for 2004 & 2005
http://www.kagi.com/birbilis
--------------
| Quote: | Hi, I'm hoping someone can give me a clue here...
I'm working on an application that automates Word to do a Mail Merge,
which comes up with a new document which the user can then modify
before printing.
At the point the document is closed, I would like to take that
document (merged/edited) and save it as a blob back into the database
(or write it out as a file)
I can grab the "Merged" document and save it to a file after it is
merged, but how can I make word save changes to my file when the
document is closed? I have noticed that in D7 there are the Word
servers which contain an OnClose for the Document, but the application
I am using is creating the Word application as a variant and I can't
seem to set the OnClose like: WordDoc.OnClose := procedure, it's
saying I don't have enough parameters???
Any help will be greatly appreciated.
Example Below:
var
WordApp, WordDoc : variant;
MergedDoc : variant;
WordApp := CreateOLEObject('Word.Application');
WordDoc := WordApp.Documents.Add(Template := aTemplateFN);
WordDoc.MailMerge.Execute;
Application.ProcessMessages;
MergedDoc := WordApp.ActiveDocument;
MergedDoc is the document that is created after the merge process,
this is what I want to make sure I save (with any changes).
Bryan Thorell
|
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|