I'm generating a report that will call an SP and return multiple pages of data. What I would like to do is dynamically create bookmarks pointing to specific pages based on the location of some given record.
Specifically, the rows will contain account data, and every unknown number of pages, a new account will begin.
For example:
Page 1: Begin Account 123
Page 20: Begin Account 456
Page 25: Begin Account 789
The account names are unique within the document, so there is no ambiguity. Is there a way to determine which page these strings will occur at so I can create bookmarks to them?
Thanks,
Dave
Retrieving page number of text location
Re: Retrieving page number of text location
Support · Apr 14, 2008Hello Dave,
Yes, you can do this by using the PlaceHolder report element. You can get the text of the record for a particular field and compare the text to add the bookmarks. You can add any page elemenet to the placeholder in the LaidOut event of the placeholder. Following is the sample code for this.
void placeHolder_LaidOut(object sender, PlaceHolderLaidOutEventArgs e)
{
string str = e.LayoutWriter.RecordSets.Current["ContactName"].ToString();
ceTe.DynamicPDF.PageElements.Label label = new ceTe.DynamicPDF.PageElements.Label(str, 0, 0, 100, 20);
e.ContentArea.Add(la);
//check the string to add bookmarks
if(str.Equals("Maria Anders"))
e.ContentArea.Add(new Bookmark(str, 0, 0));
if (str.Equals("Pedro Afonso"))
e.ContentArea.Add(new Bookmark(str, 0, 0));
}
You can refer to the Handling Events
topic on our help documentation.
Thanks,
ceTe Software Support Team.