I have written single page reports but I am now working on multiple page reports and have questions.
These reports have headers and footers with different content on the pages. The pages have different content for the headers, but the footers have the same content (file name and page number).
ISection has AddHeader(), AddFooter(), AddPage(), and AddPageBreak(). AddPage() returns a ISectionPaage object.
I am confused about how to add pages with different headers and using continuous page numbering in the footers.
I am looking for recommendations.
Hi Alf,
I'm not aware of any way to have different headers and footers on each page. The headers and footers can only implement repeating patterns as far as I know. Of course, you can use AddPageBreak and then add whatever content you want on a page, so you could put some content at the top of each page outside of the header/footer.
Here's some sample code that shows how to do page numbers in the footer.
private void button1_Click(object sender, EventArgs e) { Report report = new Report(); var section = report.AddSection(); section.PageNumbering = new Infragistics.Documents.Reports.Report.Section.PageNumbering(); section.PageNumbering.Template = "Page [Page #] of [TotalPages]"; section.PageNumbering.Continue = true; section.PageNumbering.SkipFirst = false; section.PageNumbering.Alignment = Infragistics.Documents.Reports.Report.PageNumberAlignment.Right; section.PageNumbering.OffsetX = -10; var text = section.AddText(); text.AddContent("This is the first page and it has some text on it."); section.AddPageBreak(); text = section.AddText(); text.AddContent("This is the second page and it has some text on it."); string filename = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "test.pdf"); report.Publish(filename, FileFormat.PDF); Process.Start(filename); }
private void button1_Click(object sender, EventArgs e) { Report report = new Report(); var section = report.AddSection();
section.PageNumbering = new Infragistics.Documents.Reports.Report.Section.PageNumbering(); section.PageNumbering.Template = "Page [Page #] of [TotalPages]"; section.PageNumbering.Continue = true; section.PageNumbering.SkipFirst = false; section.PageNumbering.Alignment = Infragistics.Documents.Reports.Report.PageNumberAlignment.Right; section.PageNumbering.OffsetX = -10;
var text = section.AddText(); text.AddContent("This is the first page and it has some text on it.");
section.AddPageBreak();
text = section.AddText(); text.AddContent("This is the second page and it has some text on it.");
string filename = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "test.pdf"); report.Publish(filename, FileFormat.PDF); Process.Start(filename); }
Thank you for the reply. I was able to generate different headers for the first page and subsequent pages. Use section.AddHeader() and then section.AddPage().
The project I am working on is to convert existing code from using Component One controls to Infragistics WPF & Reporting.
Now I am trying to figure out how to have two equal width columns in the header. I know I can use band.AddFlow() and Flow.AddColumn(), but how do I set the column width to half of the page?