View Categories

Bookmark with code

< 1 min read

Bookmarks with Code (Interaction.Bookmark) property allows you to form very complex structures of bookmarks in your report. However, this property alone may not be enough. For example, you should add nodes to the tree of bookmarks without using the Interaction.Bookmark property. Alternatively, the bookmarks should be placed at another level of nesting. You can use the Interaction.Bookmark property of Stimulsoft Reports. This is an invisible property, available only from code. Using this property is very easy. For example, to add a bookmark for the first level of nesting, you can use the following code:

Bookmark. Add(“My Bookmark”);

This code creates this bookmark in a tree of bookmarks.

To add a second level bookmark to the tree, you need to write code like this:

Bookmark[“My Bookmark”].Add(“Bookmark Level2”);

…and for the third tier:

Bookmark[“My Bookmark”][“Level2”].Add(“Bookmark Level3”);

To create all three bookmarks you can use the code sample above. Stimulsoft Reports will automatically check the existence of each bookmark in the tree and add any bookmarks that need to be added. You may want to use bookmarks to organize your navigation. If you need to find the components, you should record the Interaction.Bookmark property of these components. The value of the Interaction.Bookmark property should be the same as the name of the created bookmark. For example, add a bookmark.

Booking.Add(Customers.CompanyName);

therefore,Interaction. BookmarkThe value of the property looks like this:

{Customers.CompanyName}

As a result, all components are bookmarked with the company name. The same company name is added to the reporting tree. You can also click the bookmark node in the report tree to see all components.