reset pagenumbering will adding reports in a loop

Skip Navigation LinksHome  /  Support  /  Forums  /  DynamicPDF ReportWriter for .NET (v5.x)  /  Display Thread

DynamicPDF ReportWriter for .NET (v5.x) Forum

Hello,

We use a C# loop to generate reports and add them to one document.

Document document = new Document();
DocumentLayout report = new DocumentLayout(Server.MapPath("template.dplx"););
ParameterDictionary Parameters = new ParameterDictionary();

foreach (DataRow dr in dt.Rows)
{
Parameters = new ParameterDictionary();
Parameters.Add("id", dr["ID"].ToString());

report.Run(Parameters, document);
}

The template.dlpx file has a pagenumbering on it. But the pagenumber continues through the different reports added to the document.

Is there a possibility to restart the numbering for each report in the loop?

Thanks,
Frank
now using in the report:

Page %%CP(1)%% of %%TP(1)%%
Posted by a ceTe Software moderator
Hello Frank,

Yes, you can do this by using the sections and section page numbers. You will have to create sections for each report you are creating and use the below text in page numbering label and the below code for sections.

Page %%SP(1)%% of %%ST(1)%%

   foreach (DataRow dr in dt.Rows)
   {
      document.Sections.Begin();

      Parameters = new ParameterDictionary();
      Parameters.Add("id", dr["ID"].ToString());

      report.Run(Parameters, document);
   }

Thanks,
ceTe Software Support Team.
perfect answer, thanks a lot!

All times are US Eastern Standard time. The time now is 1:43 PM.