Posted 14 September 2017, 10:13 am EST
[activereports_archive]Hello Andrew,
Unfortunately, there is no direct way to get the Total page count of the PageReport when the report is loaded into the WPF Viewer. However, you can accomplish this requirement using the following work around.
Save the report into a MemoryStream using RDFRenderingExtension and MemoryStreamProvider classes. Then load the stream into a SectionDocument and you can get the page count from the section document using ‘Pages.Count’ property. Here is the suggested code:
[csharp]PageReport rpt = new PageReport(new System.IO.FileInfo(@“…..\PageReport1.rdlx”));
rpt.Run();
var doc = rpt.Document;
GrapeCity.ActiveReports.Export.Rdf.RdfRenderingExtension rdfRE = new GrapeCity.ActiveReports.Export.Rdf.RdfRenderingExtension();
GrapeCity.ActiveReports.Rendering.IO.MemoryStreamProvider provider1 = new GrapeCity.ActiveReports.Rendering.IO.MemoryStreamProvider();
doc.Render(rdfRE, provider1);
System.IO.MemoryStream ms = new System.IO.MemoryStream();
provider1.GetPrimaryStream().OpenStream().CopyTo(ms);
ms.Position = 0;
SectionDocument sec_doc = new SectionDocument();
sec_doc.Load(ms);
int PageCount = sec_doc.Pages.Count;[/csharp]
Hope it helps.
Regards,
Arpit Jain[/activereports_archive]