Getting started with label printing (mail merged)

  • I have two requirements for WP, printing letters and printing labels (both using mail merge). I will use the same dialog for both and just change its size and display setting based on the current mode.

    Label Printing:

    I want to display a text editor where the formatting and fields for all labels can be specified. This would be like Demos\Ver6Demos\LabelDef except that only ONE label is shown when editing.

    1. Is the best way to do this to modify the WPRichText1.RTFData.LabelDef to only show one row and column or is there a cleaner way?

    2. I will supply the data to fill the fields dynamically (not necessarily read from a database). Is there an event called when fields need to be filled or procedure to do same? I can't find one.

    3. (Related to 2) when replacing fields to fill a page of labels, label 1 might point to contact 1, label 2 to contact 2, etc, so how would one know which label/contact # is currently being processed?

    Thanks IA

  • Hi

    Having discovered that the PDF version is chock full of advice (I had assumed it was just a PDF version of the CHM help) I see that item 2 is handled by OnMailMergeGetText :oops:

    For 3. it looks like I would use one of the properties of the TWPMMInsertTextContents param to calculate the label #...

    • Offizieller Beitrag

    Hi,

    If you only want to show one label You need to modify the page size to be the same as one label sice.

    For printing you need a second TWPRichText whith the WPRichText1.RTFData.LabelDef being active.

    I recommend to do the mailmerge and copy the result to that, second TWPRichText as shown in the demo tasks\MailM4.

    Then you have your one label editor and the multilable preview (which also also editing - if you need that).

    I am using this feature in a software for a mueum club. I find it very useful to look at all the labels (or letters) before actually printing them. Sometimes it is possible to combine labels (Mr and Mrs were separately) or to delete entries.

    Julian

  • OK, that sounds reasonable. Use SetPageWH to set the page size to LabelDef.LabelWidth/LabelDef.LabelHeight and the Margins to the LabelDef.Padding value. I guess it would be best not to use LabelDef.Caption in that scenario...

  • Hi Julian

    It would appear that the editor disables Label mode if you set rows and columns to 1.

    To clarify my requirements, the user needs to be able to specify the content of a single label (with fields) which may use the LabelDef.Caption property.

    I am happy with either of the following scenarios:
    - (best) an editor showing a single label with border and caption showing
    - (passable) an editor full of labels is shown but only the first is editable and the rest just mirror the content of the first

    I don't want to have to show a full page of labels where all are independently editable as that would be too confusing in my app.


    I am happy to modify the WP source with your recommendations.

    • Offizieller Beitrag

    Hi,

    You are right - col and row=1 would disable the display of the lines.

    You can change this line in WPRTEPaint:

    if (RTFData.LabelDef.Active) and (Length(rtfpage.FFreeRects) > 1) then

    to

    if (RTFData.LabelDef.Active) and (Length(rtfpage.FFreeRects) > 0) then

    and it will draw the line. Next Release will also draw the caption in this case.

    Julian