We want to take RTF content and print it out including headers and footers without need of an external application like Word. It is a WinForms application is written in C#.
Questions:
- Will the footer support Page x of y?
- Can the page numbering and count be specified to start at a value greater than 1?
- Can the footer begin on the second page?
I have downloaded the trial copy of Aspose Words and if we can get a positive response the the page numbering issue will go forward with dev and purchase a license.
Thanks for any guidance you can provide.
Hi Zev,
Thanks for your interest in Aspose.Words for .NET. Yes, you can meet all these requirements by using Aspose.Words.
*Zev:
- Will the footer support Page x of y?
- Can the footer begin on the second page?*
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
// write some content in body
builder.Writeln("first page");
builder.InsertBreak(BreakType.PageBreak);
builder.Writeln("other page");
PageSetup ps = builder.PageSetup;
ps.DifferentFirstPageHeaderFooter = true;
// create empty first page header/footer
builder.MoveToHeaderFooter(HeaderFooterType.HeaderFirst);
builder.MoveToHeaderFooter(HeaderFooterType.FooterFirst);
builder.MoveToHeaderFooter(HeaderFooterType.HeaderPrimary);
builder.ParagraphFormat.Alignment = ParagraphAlignment.Right;
builder.Writeln("Right header");
builder.MoveToHeaderFooter(HeaderFooterType.FooterPrimary);
builder.ParagraphFormat.Alignment = ParagraphAlignment.Right;
builder.Write("Page ");
builder.InsertField("PAGE");
builder.Write(" of ");
builder.InsertField("NUMPAGES");
doc.Save(MyDir + @"16.12.0.docx");
doc.Save(MyDir + @"16.12.0.pdf");
Zev:
2) Can the page numbering and count be specified to start at a value greater than 1?
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
PageSetup ps = builder.PageSetup;
ps.RestartPageNumbering = true;
ps.PageStartingNumber = 5;
// write some content in body
builder.Writeln("first page");
builder.InsertBreak(BreakType.PageBreak);
builder.Writeln("other page");
builder.MoveToHeaderFooter(HeaderFooterType.FooterPrimary);
builder.ParagraphFormat.Alignment = ParagraphAlignment.Right;
builder.Write("Page ");
builder.InsertField("PAGE");
doc.Save(MyDir + @"16.12.0.docx");
doc.Save(MyDir + @"16.12.0.pdf");
Hope, this helps.
Best regards,