IMPORTANT NOTICE:
If you installed WriteWordMergeData & msWordMerge prior to version 1.0, remove them before installing TmsWordMerge!
Many thanks to Mark Radford [mradford@pandrsoftware.com] for cleaning up my code and making some great suggestions.
Also, thanks to Steve Weston [SWeston@compuserve.com] and many others who have shown me not to be so sloppy with my code and encouraged me to persevere with what appears to be a useful component!
OVERVIEW
Components to help you merge the data from a Delphi Datasource with MS-WORD Mail Merge documents! There is a general (msWordMerge) component to do the various mail merge tasks and a wizard (wzWordMerge) that encapsulates the whole thing with a simple dialog.
For instant mailmerging with Word, install the components, drop the TwzWordMerge component on a form, attach a datasource and execute!
The components were developed with D3 and MS-WORD 8. They are untested with other versions.
Original Release 28/02/1998
Copyright
If you respect copyright legislation, then the copyright to these components belongs to Final Filer Software (1998). Feel free to use the component as you see fit, but if you make changes, how about letting the rest of us know?
THE COMPONENTS:
The Main Components- msWordMerge
The Mail Merge Wizard- wzWordMerge
TmsWordMerge
The component takes a datasource and writes a text file suitable for merging with MS-WORD. It will optionally merge the data with a Word Document.
Note: TBlob fields are ignored.
The component has three public properties, no events and one method:
FLAGS:
each of the above returns TRUE if the user made a selection and sets its respective property in TmsWordMerge.
end;
NOTES:
If you DO NOT specify a WordMergeDocument name only the output file is written. No merge takes place.
If you set the MergeOption to fmsNew then
TwzWordMerge (Merge Word Wizard)
A wrapper for a wizard type dialog that encapsulates msWordMerge and presents the user with several options:
There is only one property of note- Datasource. Set it to the TDatasource that will supply the data for the merge. Optionally you can set the CAPTION for the dialog form and the data file's name (OutPutFile). Defaults are used if you leave these items empty.
EXAMPLE:
procedure TForm1.btnMergeClick(Sender: TObject);
begin
wzWordMerge1.DataSource := Form1.DataSource1;
wzWordMerge1.Execute ;
end;
The Component:
Installing The help File :
SPECIAL NOTE:
If you get messages that WORD could not open the datasource, remove the TEXT driver from the 32 OBDC settings in the Control Panel!
Version 1.13a 20th May 1998
Fixed - Neglected to include a critical file in the distribution of Version 1.13.
Version 1.13 18th May 1998
Added 'Close Word' check boxes options to twzWordMerge. When set, these will force MS Word to close when the Wizard CLoses.
Added new procedure to TmsWordMerge
CloseWordObject- closes MS- WORD.
Added two new properties-
CloseWord - When set to true Word is closed when the the tmsWordComponent is destroyed. The default is false
PromptSave- Set this to true if you want to be prompted to save the documents when WORD closes because CloseWord is set to true (see above).
Fixed problem with Word sometimes remaining minimised on preview.
Version 1.11 23rd March 1998
Fixed bug whereby another instance of WORD starts with each call. Now only one instance is used. See Function GetmsWordObject. Numerous bug fixes and a bit more bullet proofing! Added function to msWordmerge that call the file save and file open dialogs to let the user specify/ select file names:
each of the above returns TRUE if the user made a selection and sets its respective property in TmsWordMerge.
Version 1.01
Added coding to cleanly close merge and merged documents after preview and print actions.
Version 1.0 - 9/3/1998
Added twzWordMerge, a 'mail merge wizard'.
Version 1.0 - 9/3/1998
Combined the two components into 1
Added function to create a NEW word document on the fly!
Included a set of flags to choose merge options because all the boolean options were getting out of control!
4/03/1998
Two new functions for the msWordMerge component:
28/02/1998