question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. ItĀ collects links to all the places you might be looking at while hunting down a tough bug.

And, if youā€™re still stuck at the end, weā€™re happy to hop on a call to see how we can help out.

[BUG] most headerFooter options get ignored

See original GitHub issue

šŸ› Bug Report

headerFooter is supposed to have the following options: firstHeader firstFooter oddFooter evenFooter oddHeader evenHeader

Only oddHeader and oddFooter partially work. oddHeader sets text in middle header for all pages. oddFooter sets text in middle footer on all pages.

Lib version: 4.0.1

Steps To Reproduce

See JS code below. Save to xlsx file and open with Excel 20019

  const workbook = new Excel.Workbook();
  var worksheet = workbook.addWorksheet("first", {
    views: [{ showGridLines: false }],
  });

  worksheet.headerFooter = {
    firstHeader: "Hello Exceljs",
    firstFooter: "Hello World",
    oddFooter: "Page &P of &N",
    evenFooter: "even footer",
    oddHeader: "oddHeader",
    evenHeader: "evenHeader",
  };

await workbook.xlsx.writeFile("./test1.xlsx");

The expected behaviour:

Setting

    firstHeader
    firstFooter
    evenFooter
    evenHeader

should make some difference (ie header/footer text displayed on first and even pages)

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:19
  • Comments:9

github_iconTop GitHub Comments

2reactions
k4dm3lcommented, Mar 14, 2021

Hi everyone

Iā€™m trying to add a header and footer to a worksheet but it doesnā€™t work. Someone else finds how to solve this or how to add the header and footer to a worksheet? Iā€™m using the next options object

const workSheet = workBook.addWorksheet('General Report', {
      pageSetup: {
        fitToPage: true,
        paperSize: 9,
        horizontalCentered: true,
        margins: {
          left: 0.1,
          right: 0.1,
          top: 1,
          bottom: 1,
          header: 1,
          footer: 0.3,
        },
      },
      headerFooter: {
        oddHeader: 'TEST HEADER',
        oddFooter: 'TEST FOOTER',
      }
  })

Iā€™m the package version 4.2.1. I try to follow this example but in my case does not work. #https://github.com/exceljs/exceljs/issues/1413

Thanks!

2reactions
chenopcommented, Jul 9, 2020

Few Details: I notice ā€œHeader & Footerā€ is a new feature - Updating to version 4.1.0 - showed the oddHeader. firstHeader & firstFooter does not work.

Also in order to see the header you have to do the following in excel: View --> ā€œPage Layoutā€ (You cannot see header in ā€œNormalā€ Layout)

Read more comments on GitHub >

github_iconTop Results From Across the Web

"Cannot parse header or footer so it will be ignored" on ...
It's not an error, it's a warning. It's telling you that openpyxl lacks support for some of the features of the file you...
Read more >
WordPress 5.9 header/footer and/or Body not working together.
I started getting different error messages about things being incompatible and tried variations. I could get the pages to display, but theĀ ...
Read more >
header footer - fancyhdr package not working - TeX
So I'm using the fancyhdr package and compiling my code and it gives me no error whatsoever butĀ ...
Read more >
PM30890: RPE: Stylesheet ignored Same as Previous settings - IBM
Closed as program error. Error description ... matter with header/footer defined -insert a next page section break -on the 3rd page, set the...
Read more >
33304 ā€“ Header / Footer should be inserted into margin, not ...
The ability to put the header/footer in the margin would save me this ... top margin to 1 cm, then add a header,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found