TmsWordMerge For Delphi 4/3


IMPORTANT NOTICE:

If you  installed  WriteWordMergeData & msWordMerge prior to version 1.0, remove them before installing TmsWordMerge!


From Final Filer Software
(Pierre du Parte)
http://www.finalfiler.com
mailto:finalfiler@finalfiler.com
Release 1.2.1
  • Thanks
  • 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!

    Special thanks to Mark Newmister (mailto:Mnewmister@rig.com) for the ODBC Text disable/ enable code

     

    Top Of Page

    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

    Top Of Page

    LICENCE: Free!

    CONDITIONS OF USE-

    GUARANTEES, WARRANTIES ETC.

    RESPONSIBILITY:

    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?

    Top Of Page

     

    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:

    PROPERTIES:

    FLAGS:

    METHOD:

     

    each of the above  returns TRUE if the user made a selection and sets its respective property in TmsWordMerge.

    Sample:

    procedure TForm1.Button1Click(Sender: TObject);
    begin
    With WriteWordMergeData1 do
    begin
    DataSource := Datasource1;
    OutputFile := 'C:\Windows\Desktop\result.txt';
    Execute;
    end;

    end;

    USING THE COMPONENT:

    1- Drop the component on a form.
    2- Set the Datasource property to a valid TDatasource component
    3- Set the Outputfile path and name. This should be a text file!
    4- Set the WordMergeDocument which MUST be a valid WORD document file!
    5- Select the MergeOption - New, Preview, Print or None!
    4- Call the components execute method.

    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;

    Top Of Page

     

    INSTALLATION:

    The Component:

    In Delphi 3 Click File|Open
    Select msWordMerge.dpk
    In the subsequent Dialog click Compile
    Click Install

    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!

    Top Of Page

      

     HISTORY

    Version 1.21 9th April 1998

    Two new properties:

    ODBCTextOff

    When the ODBC Text driver is installed, mail merging could not be invoked. Removing the driver would fix this. However, there is now a flag you can set to disable the text driver while the merge occurs. When merging is done, the text driver is enabled again.

    The patch for this was supplied by Mark Newmister mailto:Mnewmister@rig.com

    Delimiter

    There is now a flag you can set to select comma delimited (default) or tab delimited export files

     Version 1.21 25th October 1998-10-25

    Three new methods exposed in MSWordMerge
    GetActiveDocument : OLEVariant;
    SaveActiveDoc
    SaveActiveDocAs(fileName: String);
     

    Version 1.2  6th June 1998

    Exposed two more methods-

    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.12

    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

     

    Top Of Page