Substituting merge fields in header/footer with reporting

  • Hi

    I am using the following code to add substitution of merge fields in the header/footer to the reporting feature, which does not substitute the header/footer by default. The code seems to work, but the page margins are not preserved. How do I preserve the page settings? Is this the best approach (it is based on the WPTools 5 approach with super merge)?

    Also, I am using this code in a web application, and I get a 'Runtime error 217' whenever I close the ASP.Net development server after running this code. What am I doing wrong?

    Thanks
    Andrew

    • Offizieller Beitrag

    Hi,

    the reporter does not work with regular header/footer. It will create new header/footer in Memo2 from the header/footer BANDS!

    You can load the template into Memo2 and do a MailMerge there, rtf.Memo2.MergeText is the correct way to do it.

    But this code would avoid the extra load

    Memo2.AppendOtherText(4);
    https://www.wpcubed.com/manuals/textdy…ndothertext.htm

    Now you can use ClearBody and do the Memo2.MergeText

    It will preserve the pagesize of the original template

    Regards,
    Julian

  • I also get the same "runtime error 217" when I close my application. However it does not happen all the time, only occasionally. Perhaps there is some kind of race condition?

    I am using WPTextDynamic in a WinForms2 application. I know this isnt the correct forum but i think it might be related to the one that was mentioned above. I have posted a copy of this in the correct forum also.

    I found that it happens in a very simple new project that has no code, and simply is a WinForm with the text editor control embedded. run the app, close the app and occasionally you get the runtime error.

    I also have the following behaviour in the simple test app, which i think is probably related -

    Run the app in debug, then close the app, VSHost.exe crashes every time
    Embed the WPTextDynamic control inside a user control. Use that user control in an otherwise empty form. Save the form.
    Now close the form designer inside the VS IDE (in my case VS 2008 with all the service packs) and kaboom! the VS IDE crashes.... every time


    I think all of these are related as they all happen when the form is dismissed.

    What solution can i use to get rid of these problems?
    i'm not so concerned about the VS IDE.
    i am concerned about the runtime error. It makes my otherwise polished app look very bad, and the window that comes up is in a style that doesnt look like a VS message, or a system message. It looks more like a custom exception handler within the control itself.