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

Created on 6 Dec 2019  路  5Comments  路  Source: dolanmiu/docx

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.

bug feature request

All 5 comments

Thanks for your kind words :)

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

Thank you! Just wanted to make sure that I did not miss anything :)

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

@wcqrnj Thank you so much for the tip, I appreciate it!

Demo 14 and 39 are now fixed

Closing

Was this page helpful?
0 / 5 - 0 ratings