LINQ reference to bookmarks page number

We can insert links to our content dynanamically by using the below LINQ syntax

<<link [quest.id] ["Bookmark Text"]>>

Which properly renders a clickable link with the text “Bookmark Text”

However we would like the text of the link to be dynamic and display the page number like “Bookmark on Page 3”

What is the LINQ syntax for this? LIke how can we get access to the PAGEREF in the LINQ syntax. I thought it might be something like this, but I don’t think this will work?

<<link [quest.id] ["Bookmark on Page "] <<PAGEREF [quest.id]>> >>

@IT2BE You should insert PAGEREF field into your template. The syntax should look like this:

<<link [quest.id] ["Bookmark on Page "]>>{ PAGEREF <<[quest.id]>> \h }

For example see the attached simple template and the following code:

Document doc = new Document("C:\\Temp\\in.docx");
ReportingEngine engine = new ReportingEngine();
engine.buildReport(doc, "test", "bookmarkName");
doc.updateFields();
doc.save("C:\\Temp\\out.docx");

in.docx (12.6 KB)
out.docx (10.1 KB)

1 Like

<<link [quest.id] ["Bookmark on Page "]>>{ PAGEREF <<[quest.id]>> \h }
It works for me.
But Is there any way how to merge string with PAGEREF?

<<link [quest.id] ["Bookmark on Page" + {PAGEREF <<quest.id>> \h}] >>

@kkzlozdev I am afraid, there is no way to include fields into the LINQ syntax.