get number of page GetAnchorPage
hi how can i get GetAnchorPage in FastReport .NET for New Posts FastReport VCL
we do like this and in .Net
[Engine.GetAnchorPage(<x1."NUn">)]
Engine.AddAnchor(<x1."NUn">);
Thank you
we do like this and in .Net
[Engine.GetAnchorPage(<x1."NUn">)]
Engine.AddAnchor(<x1."NUn">);
Thank you
This discussion has been closed.
Comments
Hello!
In the designer: Report → Options… → General → Double pass.
Or in the C# code before `Prepare()`:
report.DoublePass = true;2. Add an anchor and retrieve the page number in the report script (C#)
In the report script (the “Code” tab), use Report.GetColumnValue(“x1.NUn”) instead of <x1.“NUn”>:
// In the main data band (in the BeforePrint handler), where the section is printed: private void Data1_BeforePrint(object sender, EventArgs e) { string key = Convert.ToString(Report.GetColumnValue(“x1.NUn”)); if (!string.IsNullOrEmpty(key)) { Engine.AddAnchor(key); } } // On the TextObject (for example, in the table of contents, in the BeforePrint handler): private void TextPageNum_BeforePrint(object sender, EventArgs e) { if (Engine.FinalPass) { string key = Convert.ToString(Report.GetColumnValue(“x1.NUn”)); int pageNumber = Engine.GetAnchorPage(key); (sender as TextObject).Text = pageNumber.ToString(); } }If you are outputting the value directly in the TextObject text without a BeforePrint handler, you can also use the following expression in FastReport .NET:
[Engine.GetAnchorPage(Convert.ToString([x1.NUn]))]provided that DoublePass is enabled and the call to Engine.AddAnchor(...) has already been executed on the corresponding band during the first pass