You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to create a Table Of Contents manually because TableOfContent was not displaying anything, by keeping a reference to headers and render then with InternalHyperlink.
Below is the simplified version of the code:
constheaders=[{id: 'mainheaders1',text: '1. General'},]constborders={};constrows=[];constlinkText=newTextRun({text: headers[0].text,style: 'headerLinkText',});constlink=newInternalHyperlink({anchor: id,children: [linkText],});constpageNumber=newParagraph({alignment: 'end',style: 'headerLinkText',children: [newTextRun(' '),newPageReference(id,{hyperlink: true})],// ! PageReference is not working on most docx editors, only in LibreOffice});constrow=newTableRow({children: [newTableCell({margins: {top: 120,bottom: 120,},
borders,width: {size: 70,type: WidthType.PERCENTAGE,},children: [newParagraph({children: [link],}),],}),newTableCell({margins: {top: 120,left: 240,},
borders,width: {size: 30,type: WidthType.PERCENTAGE,},children: [pageNumber],}),],});rows.push(row);constcontentsTable=newTable({margins: {left: 0,top: 0,right: 0,bottom: 0,},
borders,width: {size: 100,type: WidthType.PERCENTAGE,},
rows,});constsection: ISectionOptions={properties: {type: SectionType.NEXT_PAGE,},children: [pageHeader,contentsTable],};
Opened in Microsoft Word, this is how the document was rendered:
And this is how it was rendered in LibreOffice:
The hyperlinks work in all editors, but i'd like the PageReferences to work on all editors too, are there any special handling required for specific editors ?
Big thanks to the maintainers of this project.
The text was updated successfully, but these errors were encountered:
Issue
Environment
Description
I am trying to create a Table Of Contents manually because TableOfContent was not displaying anything, by keeping a reference to headers and render then with InternalHyperlink.
Below is the simplified version of the code:
Opened in Microsoft Word, this is how the document was rendered:
![toc](https://private-user-images.githubusercontent.com/129714389/396763771-397f2c68-4f87-4200-b7bf-df6f69d8914d.jpg?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzg5NTk1NzYsIm5iZiI6MTczODk1OTI3NiwicGF0aCI6Ii8xMjk3MTQzODkvMzk2NzYzNzcxLTM5N2YyYzY4LTRmODctNDIwMC1iN2JmLWRmNmY2OWQ4OTE0ZC5qcGc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjA3JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIwN1QyMDE0MzZaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT1jOWJiMzQyNzQwYWZkZTllNTZmYjZiZTg4YTljZmQ3ZTFmYjI1NzMyNjk4M2RkNTdkOTU5YzBiN2Q0MDQ1ODZiJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.YigCDJ9rsxUiRqUdtyuesR7EAJdpG8TpF5TA020DPfw)
And this is how it was rendered in LibreOffice:
![toc-libre](https://private-user-images.githubusercontent.com/129714389/396763989-da8c0b50-87b7-434d-bef1-8f7038622a74.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzg5NTk1NzYsIm5iZiI6MTczODk1OTI3NiwicGF0aCI6Ii8xMjk3MTQzODkvMzk2NzYzOTg5LWRhOGMwYjUwLTg3YjctNDM0ZC1iZWYxLThmNzAzODYyMmE3NC5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjA3JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIwN1QyMDE0MzZaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT1lMTJlMjJlYmJlMjc2MmNmM2E0ZTgxMDcyYzllMDA1NGYyNjQ3MjQxNjY4ODcyYTNiNzkwZDI2NjFkMjNlMjZmJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.cTrkMavbQIvkYuML3S_zNd_fCHza3xOHQhXC3PNCG84)
The hyperlinks work in all editors, but i'd like the PageReferences to work on all editors too, are there any special handling required for specific editors ?
Big thanks to the maintainers of this project.
The text was updated successfully, but these errors were encountered: