Merging two or more WPT's together

  • What is the best method to merge them together?


    I tried


    Code
    1. par := SourceDok.FirstPar;
    2. while assigned(par) do begin
    3. // Append it to the active RTFDataBlock
    4. DestDok.ActiveText.AppendParCopy(par);
    5. // This moves to the next paragraph! Useful in a loop!
    6. end;


    but then some style and formatting are not copied correctly ...

  • i tried following :


    But still no formating ...

  • oh, i see the problem .....


    the second WP ist generated with a mailmerge ...


    Code
    1. Contents.StringValue := temp; // temp is a really big WPT Text with Formated things, styles and more ...


    Can this be the problem?

  • Hi,


    You need to *create* a new RTFDataProps, do not just use the one from a different editor


    // destEditor allready created and has still a RTFProps
    fRTFDataProps := destEditor.RTFData.RTFProps;


    This requires that all editors use that event.


    Julian

  • I changed my code so that all editors now use the event.


    But i think the problem is the mailmerge, not the merging of two editors ....


    I have a big WPT Text (a document) which i mailmerge into an other document.


    Can the mailmerge handle whole WPT Document to be inserted?

  • Hi,


    Merging whole dokuments is not ideal. I would insert a placeholder, such as


    @INSERT1234@


    and locate that placeholder in a scond step (Finder.Next() Finder.SelectText)


    The use LoadFromFile/Stream to insert the document and replace the token at the same time.

  • thanks for the additional help, but it still will not work :(


    I think i have found why it doesn't work, but don't know how to fix ...


    I have replaced the Mailmerge with your @INSERT@ method, after this the document seems to be ok.


    But if i merge the two documents (After the mail merge) together with the AppendParCopy function
    The resulting document is missing the "numberstyles" section
    And therefore the numbering is wrong.[/code]



    ..... habs nun statt AppendParCopy, einfach ein Finder.ToEnd; und dann LoadFromString gemacht, nun passt es ....


    Danke für die Hinweise ...