openxlsx icon indicating copy to clipboard operation
openxlsx copied to clipboard

Headers and Footers: NA to skip position comes out as string literal "NA" in actual Header/Footer

Open michael-m52 opened this issue 3 years ago • 0 comments

Describe the bug This bug first appears in 4.2.4 and is still in 4.2.5 NA is specified in the documentation as "skip position", but it is actually being sent to the document as string literal "NA" The bug happens when adding headers and footers using addWorksheet. It does not occur when adding headers and footers using setHeaderFooter.

To Reproduce

  1. Open the latest document https://cran.r-project.org/web/packages/openxlsx/openxlsx.pdf
  2. Reproduce the code in page 9 for addWorksheet and run it
  3. New file created addWorksheetExample.xlsx.
  4. Reproduce the code in page 78 for setHeaderFooter and run it
  5. New file created setHeaderFooterExample.xlsx

Expected behavior setHeaderFooterExample.xlsx has the correct expected behaviour. NA in the header and footer specification is coming out with blank parts of the header and footer

addWorksheetExample.xlsx Sheet 6 should not have NA in the left/right header/footer areas. It should be blank.

Screenshots image image

Example files addWorksheetExample.xlsx.

Additional context As a workaround, I will specify "" instead of NA, so that addWorksheet puts an empty string into the header/footer instead of "NA"

michael-m52 avatar Feb 18 '22 05:02 michael-m52