Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
115
AddMergeCode - what does it do?
posted

I am trying to find out the use of AddMergeCode() for the IText object.

It asks for a name but the name of what?

Is it like a placeholder?  If not is there a way I can add a place holder?

For example.  I have a report that I produce on the fly.  I dont know until the end of the report how many pages of pictures I have added but i need to specify that number in the middle of the report.  I currently do it by using a variable to act as that placeholder and then go back and count the picture pages then write it to the text variable.  However if there was a way to add a placeholder then it would make it a lot easier to manipulate the text.

Is this the AddMergeCode?

  • 37774
    posted

    You are correct that AddMergeCode will provide a means of a placeholder for you to later change the string.  What you need to do is write a class that implements the ICallback interface and to assign an instance of this class to the Callback property of the report.  The only method you really need to worry about in this case is OnMergeCode, within which you check for the name that you specified in the AddMergeCode method and return the appropriate string.

    -Matt