With Aspose 20.4 I’m finding with the following code…
const string FooterBold = "&\"Arial,Bold\"&6";
const string FooterStandard = "&\"Arial,Standard\"&6";
string testFile = "Book1.xlsx";
using (var inputStream = File.OpenRead($@"E:\Temp\{testFile}"))
{
using (var outputStream = File.Create($@"E:\Temp\{DateTime.Now:yyyyMMdd-HHmm-ss}_{testFile}"))
{
Workbook workbook = new Workbook(inputStream);
foreach (Worksheet sheet in workbook.Worksheets)
{
PageSetup pageSetup = sheet.PageSetup;
pageSetup.SetFooter(0, $"{FooterStandard}XXX-XXXX-XX-0000-00.0");
string footerText = $"{FooterBold}Approver {FooterStandard}| Xxxxxxxxxxx Xxxxxxx | ";
footerText += $"{FooterBold}Owner {FooterStandard}| Xxxxxxxxxxx Xxxxxxx | ";
footerText += $"{FooterBold}Effective {FooterStandard}| 26/07/2019";
// Set Footer
pageSetup.SetFooter(
1,
footerText);
string footerPage = "&\"Arial,Standard\"&6P. &P of &N";
pageSetup.SetFooter(2, footerPage);
}
SaveFormat format = FileFormatUtil.ExtensionToSaveFormat(".xslx");
workbook.Save(outputStream, format);
}
}
I’m finding the text in the right hand section appearing in the excel document is "P. " I was expecting something like “P. 1 of 5”.
When you comment out the code for either the right hand section or the middle section, mysteriously the expected text in the right hand section is output.