-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refreshing Table of Contents after document generation #105
Comments
hello @achempion, could you please attach an example document with this effect? |
Hello @achempion, thank you for the detailed issue and the example and sorry for the late answer. About the original issue: The problem with TOC generation is that apart from parsing the structure of the document, it also needs to calculate page numbers. Page numbers depend on many factors: the layout of the document, spacing and even the font used. You can check it yourself: If you open a large docx document (like a long book with hundreds of pages) in Word and in LibreOffice, it is likely that the total number count will not match in the two programs, despite the standardization of the OOXML format and the decades of engineering work put in improving compatibility. Therefore, correct TOC generation is not in the scope for this small library. About regenerating TOC in virtualized LibreOffice: I think this should be the correct solution to your problem. The TOC should be generated in the last step (immediately preceding printing or exporting to PDF) so the page numbers in the table will be in sync with the actual page numbers. The bug you found about the extra |
hello @achempion, how do you trigger refresh of Table Of Contents? |
I'm triggering update with Screen.Recording.2022-02-08.at.23.34.19.mov |
Is your feature request related to a problem? Please describe.
You can create a document with multiple headings and then use a docx feature called "Table of Contents" which will display table of contents based on those headings.
In LIbreOffice it's located here: Insert -> Table of Contents and Index -> Table of Contents, Index or Bibliography...
If you change the headings, you can regenerate table of contents in with Tools -> Update -> Update all
Some headings & sections in stencil can be hidden with if clause, which means table of contents becomes outdated.
Describe the solution you'd like
It would be nice to make stencil refresh table of contents after document gets compiled.
Describe alternatives you've considered
It's possible to resolve this issue manually by introducing additional step in the rendering process, by running virtualized libreoffice and asking it to refresh the contents.
The text was updated successfully, but these errors were encountered: