Class TWPSuperMerge

Hierarchy

System.TObject | System.Classes.TPersistent | System.Classes.TComponent | WPRTEEdit.TWPAbstractSuperMerge | TWPSuperMerge

Description

TWPSuperMerge - this object is the control center of the WPReporter tool set.
It controls the creation of a new text using a report template and information aquired through different events. Please see the PDF manual for more information.
To work with it you need in Form.OnCreate SuperMerge.SetSourceDest(EditorIn.RTFData, EditorOut.RTFData);
If you need to copy section breaks use the flag wpAllowSectionStartInHeaderFooterBands in Options.
To preserve number- and paragraph styles the input and output should use the same RTFProps object.
You need a global variable FAllProps: TWPRTFProps
which is assigned in the event used by both TWPRichText. In Form.OnDestroy the FAllProps has to be freed.

 
    procedure TForm1.EditorInitializeRTFDataObject(Sender: TObject;
      var RTFDataObject: TWPRTFDataCollection; var FAllProps: TWPRTFProps);
    begin
      if FAllProps=nil then
         FAllProps := TWPRTFProps.Create;
      RTFPropsObject := FAllProps;
    end;
   

Properties

Methods

Events

AfterCopyParagraph : TWPAfterCopyParagraph= TWPAfterCopyParagraph

This event will be triggered for each paragraph which has been created during the report creation. It can be either a single paragraph or a table row (ParagraphType=wpIsTableRow). The event is triggered BEFORE the fields are merged, so it is possible to modify the paragraph and delete or insert fields!

AfterProcessGroup : TWPAfterProcessGroupDataEvent= TWPAfterProcessGroupDataEvent

This event will be executed after the group has been processed. It controls if the group is processed again. You cannot use this event to create a data stack - please use the CustomData obiecht for this. After this event the footer of the group is beeing created

AfterProcessGroupData : TWPAfterProcessGroupDataEvent= TWPAfterProcessGroupDataEvent

This event will bebtriggered after the data bands have been processed

BeforeProcessGroup : TWPBeforeProcessGroupEvent= TWPBeforeProcessGroupEvent

This event is executed before the group is executed. To build your won datastack assign an object to "CustomData". That object will be freed automatically

OnEnterBand : TNotifyEvent= procedure (Sender : TObject) of Object

This event is triggered during editing when the user enteres a band. Also see OnLeaveBand.
Example:
 
      procedure TWPRepForm.WPSuperMerge1EnterBand(Sender: TObject);
        var band :  TWPBand;
        begin
         band := WPGetBandForPar(SourceText.ActiveParagraph);
         Caption := 'Enter Band ' + band.Alias;
        end;


        procedure TWPRepForm.WPSuperMerge1LeaveBand(Sender: TObject);
        var band :  TWPBand;
        begin
         band := WPGetBandForPar(SourceText.ActiveParagraph);
         Caption := 'Leave Band ' + band.Alias;
        end;
        

OnFinalizeGroup : TWPOnFinalizeGroupEvent= TWPOnFinalizeGroupEvent

This event is triggered after a group and the group footer have been processed. Do not use this event to ouput any data, it is meant to maintain the organization of group data structures. Please note that BeforeProcessGroup happens several times inside a group - you can test "count=1" to check if it was the first call to BeforeProcessGroup.

OnLeaveBand : TNotifyEvent= procedure (Sender : TObject) of Object

This event is triggered during editing when the user leaves a band.

OnMailMergeGetText : TWPMailMergeGetTextEvent= TWPMailMergeGetTextEvent

We are now using the standard mail merge event, it uses the same syntax as the event TWPRichtext
>>

OnPostProcessBandData : TWPOnPostProcessBandData= TWPOnPostProcessBandData

This event makes it possible to modify a paragraph after it was created in the destination text buffer. It is triggered after the entire text for a band was created. The start and end paragraphs are passed to the event. The paragraph references can refer to normal paragraphs or table row paragraphs. You can use this event to add flags to paragraphs to mark certain areas in the report.

OnPrepareFooter : TWPPrepareBand= TWPPrepareBand

OnPrepareHeader : TWPPrepareBand= TWPPrepareBand

This event is triggered before a header band is added

OnPrepareText : TWPPrepareBand= TWPPrepareBand

OnUserBreak : TNotifyEvent= procedure (Sender : TObject) of Object

This event is triggered when the user presses ESCAPE while a formula is evaluated. This makes it possible to interupt infinitve loops, for example cause by 'true' as condition is the StartCode of a group.

Used or referenced by

-Function TWPRTFDataCollection._SuperMerge : TWPAbstractSuperMerge
-Function TWPRTFDataCollection._SuperMerge : TWPAbstractSuperMerge
-Function TWPBand.VarFindRec(SuperMerge:TWPSuperMerge; VarName:string) : TWPBandVar