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.

[v5.0.0.-rc7] Page number demo -> "TypeError: Cannot read property 'CURRENT' of undefined"

See original GitHub issue

Is it possible that some configuration or such is missing from the page numbers demo? https://github.com/dolanmiu/docx/blob/master/demo/14-page-numbers.ts

I am using v5.0.0-rc7 and I am getting this error when running it: TypeError: Cannot read property 'CURRENT' of undefined

EDIT: Same error for demo 39: https://github.com/dolanmiu/docx/blob/master/demo/39-page-numbers.ts

I did not only come to complain, however 😃 Thank you @dolanmiu for this library, and especially for the new rewrite: it makes code much more readable and intuitive.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:2
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
He-Wolfcommented, Dec 16, 2019

Is it possible that some configuration or such is missing from the page numbers demo? https://github.com/dolanmiu/docx/blob/master/demo/14-page-numbers.ts

I am using v5.0.0-rc7 and I am getting this error when running it: TypeError: Cannot read property 'CURRENT' of undefined

EDIT: Same error for demo 39: https://github.com/dolanmiu/docx/blob/master/demo/39-page-numbers.ts

I did not only come to complain, however 😃 Thank you @dolanmiu for this library, and especially for the new rewrite: it makes code much more readable and intuitive.

Hello @acgrama,

You can use pageNumber() and numberOfTotalPages() functions of TextRun according to the API: https://docx.js.org/#/usage/page-numbers image I created an example in codepen according to demo 39: https://codepen.io/wcqrnj/pen/abzBNqJ

Unfortunatelly the header of the first page is not different in case of demo 14: https://codepen.io/wcqrnj/pen/yLyVOEN

Fortunetelly there is a workaround. You can create two sections and add different footers: https://codepen.io/wcqrnj/pen/zYxoBvE

Cheers, He-Wolf

1reaction
dolanmiucommented, Dec 9, 2019

Thanks for your kind words 😃

Probably because it isn’t exported, i will fix in the next release

Read more comments on GitHub >

github_iconTop Results From Across the Web

TypeError: Cannot read property 'current' of undefined
The bot can't read the property of current . You used current after results[0] , which means that that's undefined.
Read more >
creating a unit test typeerror: cannot read property ... - You.com
It is complaining that cannot read property 'replace' of undefined. replace is a method of String in JS and instead it found undefined...
Read more >
About this Book - Angular 2 Development with TypeScript
This book covers Angular 2.0.0 Final. How to read this book. Our early drafts of this book started with chapters on ECMAScript 6...
Read more >
testcafe - UNPKG
205 .page`http://devexpress.github.io/testcafe/example`; ... 736, * Fixed an error (`Cannot read property 'on' of undefined`) that occurred when testing ...
Read more >
https://raw.githubusercontent.com/valor-software/n...
... Demo site does not load resources \(valor-software.com/ng2-charts/\) ... navigation error occurs - "Cannot read property 'onDestroy' of undefined" ...
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