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.

First page footer is not working!

See original GitHub issue

I have found this code through one of the pull requests/threads. It is supposed to work but somehow it is creating an empty page for first attribute. default is working as it is supposed to.

const footer1 = doc.createFooter();
  footer1.createParagraph('Footer on another page');
  const footer2 = doc.createFooter();
  footer2.createParagraph('Footer on first page');

  doc.addSection({
    footers: {
      default: footer1,
      first: footer2
    },
    pageNumberStart: 1
  });

version: 4.7.1

What could be the possible reason for this?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
zahrafalicommented, Jul 12, 2019

demo14 doesnt work

0reactions
dolanmiucommented, Mar 15, 2021

Got it working, you need the titlePage attribute for first page headers and footers to work

I have amended demo 14 to showcase this:

https://github.com/dolanmiu/docx/blob/master/demo/14-page-numbers.ts

Read more comments on GitHub >

github_iconTop Results From Across the Web

"Different first page" does not seem to work
Use a Next Page Section Break from the Page Layout tab's Page Setup, Breaks to separate page 1 from the rest of the...
Read more >
Word 2010 header "different first page" option does not ...
Try creating a new section break between your first and second pages. Then try the header for the first page and preset for...
Read more >
Headers in Word – "Different first page" issue
In a book I'm writing, I start each new chapter with a section break (next. Naturally I don't want a header on the...
Read more >
Make the First Page Header or Footer Different in Word
Go to the Header & Footer tab, click the Header or Footer icon, select a format if desired, and type the new information...
Read more >
uncheck Different first page option without losing its content
The link to previous/same as previous setting refers to the equivalent header/footer in the previous Section of the document, not to a different ......
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