EPPlus usage
Commercial use (I have a commercial license)
Environment
Windows
Epplus version
8.4.0
Spreadsheet application
Excel
Description
I got an Excel with an Footer "Seite &[Seite] von &[Seiten] / page &[Seite] of &[Seiten]".
It is displayed as "Seite 1 von 1 / page 1 of 1".
If I open Excel with EPPLUS. Then access the footer and save it under an new name, the space before "von" and "of" is missing: "Seite 1von 1 / page 1of 1"
This is a minimal sample to reproduce the code.
ExcelPackage.License.SetNonCommercialPersonal("<Your Name>");
using var package = new ExcelPackage("Sample.xlsx");
// This Line does remove the white space before "von" and "of"
_= package.Workbook.Worksheets.First().HeaderFooter.OddFooter.LeftAlignedText;
package.SaveAs("Sample_EPPLUS.xlsx");
Sample.xlsx
Sample_EPPLUS.xlsx
I think the error comes from recent changes in ExcelHeaderFooterTextCollection.cs.
If I change this code:
else if(writeFormatCode && temp.FormatCode == ExcelHeaderFooterFormattingCodes.PageNumber)
{
if (hfText[i] == '+' || hfText[i] == '-')
{
temp.PageNumberSuffix += hfText[i];
}
i++;
while (char.IsDigit( hfText[i]))
{
temp.PageNumberSuffix += hfText[i];
i++;
}
}
to
else if(writeFormatCode && temp.FormatCode == ExcelHeaderFooterFormattingCodes.PageNumber)
{
if (hfText[i] == '+' || hfText[i] == '-')
{
temp.PageNumberSuffix += hfText[i];
i++;
while (char.IsDigit( hfText[i]))
{
temp.PageNumberSuffix += hfText[i];
i++;
}
}
}
it is working again.
EPPlus usage
Commercial use (I have a commercial license)
Environment
Windows
Epplus version
8.4.0
Spreadsheet application
Excel
Description
I got an Excel with an Footer "Seite &[Seite] von &[Seiten] / page &[Seite] of &[Seiten]".
It is displayed as "Seite 1 von 1 / page 1 of 1".
If I open Excel with EPPLUS. Then access the footer and save it under an new name, the space before "von" and "of" is missing: "Seite 1von 1 / page 1of 1"
This is a minimal sample to reproduce the code.
Sample.xlsx
Sample_EPPLUS.xlsx
I think the error comes from recent changes in ExcelHeaderFooterTextCollection.cs.
If I change this code:
to
it is working again.