Mailmerge in WP Tools v.5

  • Hi,
    We are trying to use the mailmerging function in WPTools 5. It works very well for standard merge fields, but we dont know how to solve the following case.

    We want to manually perform a mailmerge with repeating lines in a longer text. For example this could be used for an invoice, where the customers information is filled in via ordinary mailmerge, and the invoice lines (ordered items) are filled in via manual mailmerge.

    Simply described: We want to repeat parts of the text an arbitrary number of times and then manually fill the mailmerge fields of the repeated text.

    Example with a simple invoce form:

    *************************
    <CustomerName>
    <CustomerAddress>
    <CustomerZip> <CustomerCity>

    Ordered items
    <Code> <Title> <Amount>

    *************************

    We are able to locate (find the field and locate the cursor) at the mailmerge field <Code>. But we have not been able to repeat the line with this mailmerge field on an arbitrary number of times. More specific: We want to copy the line "<Code> <Title> <Count>." to a variable. Then we want to insert the contents of this variable into our rtf the same number of times as the customer has items in the invoice.

    The result should look something like this:

    *************************
    Ola Normann
    West End 245
    7000 Trondheim

    Ordered items
    1234 Title of product 123 $
    2345 Title of product 234 $
    3456 Title of product 345 $

    *************************


    Our questions:
    1. Is it possible to manually perform this kind of mailmerging in wpTools?
    2. Is there any better solutions? Maybe Wp Reporter? It is important that it is flexible.

    • Offizieller Beitrag

    Hi,

    Zitat

    1. Is it possible to manually perform this kind of mailmerging in wpTools?


    Yes, it would requires ome kind of coding and a second editor where you combine the texts.

    Zitat

    2. Is there any better solutions? Maybe Wp Reporter? It is important that it is flexible.

    This is the standard use of WPReporter. You would only have to insert a group around the template line with <Code> <Title> <Amount> .

    In the template this will look like

    <group>
    <Code> <Title> <Amount>
    </group>

    You can use a simple event to process the group as long as there are items to be inserted.

    WPReporter does not modify the template, it always creates the text in a destination editor.

    You can get WPReporter using this link:
    http://shareit1.element-5.de/cart.html?PRODUCT[130393]=1&language=English

    Julian

  • Thanks!

    In WPReporter, can you split parts of a page in 2 sections? Something like this:

    -------------------------------------------------------
    <CustomerName>
    <CustomerAddress>
    <CustomerZip> <CustomerCity>

    (table cell 1..) | (table cell 2)
    <group> | This is a text.
    <Code> <Title> <Amount> | Multiline.
    </group> | It should be independent of table cell 1

    -------------------------------------------------------

  • We'll try to solve our problem in WPTools 5 this time.
    Narrowing down the problem, we can describe it something like this:

    1. We can locate the text we want to copy to another WPTools editor by looping through mailmergefields. When reaching the correct mailmerge field, how can we select and copy the entire line of text this mailmerge field belongs to and paste it into another WPTools editor?

    2. How do we repeat the line of text pasted into the second editor?

    3. How do we replace the original line of text in the first editor with the multiple lines in the second editor?

    • Offizieller Beitrag

    Hi,

    Zitat

    1. We can locate the text we want to copy to another WPTools editor by looping through mailmergefields. When reaching the correct mailmerge field, how can we select and copy the entire line of text this mailmerge field belongs to and paste it into another WPTools editor?

    Inside the OnMailMergGetText event the curnet field is selected. So you can read the text using SelectionAsString or SaveSelectionToStream.

    Zitat

    2. How do we repeat the line of text pasted into the second editor?

    Multiply LoadFromStream will do it.

    Zitat

    3. How do we replace the original line of text in the first editor with the multiple lines in the second editor?

    Assign WP2.AsString to the property Contents.StringValue.

    Julian