stable

Clone or download

Read-only

Prefill the table of contents of the generated document

For now the page number is not added, it will be added later. Most (all?) of the tools using docx documents do not generate the table of contents when the document is opened (at least not without an extra confirmation). This happen for multiple reasons: * the generation of the TOC can take some non negligible times on large documents * the TOC might refers to external fields so you might not want to access them each time you open the document The strategy adopted by the text editors seems to be to prefill the TOC with the content. This way, even if the user do not generate it explicitly, it does not seem broken. The library used to generate the document does not support this directly so we re-implement it. However in a effort to (vastly) reduce the complexity the implementation is specific for our use case. Part of story #22213: get a document with basic fields Change-Id: I2e7d35468545507c00fa136f5d85fd378c5b6617

Modified Files

Name
A plugins/document_generation/scripts/tracker-report-action/src/Exporter/DOCX/TableOfContents/table-of-contents-test-samples.ts +210 −0 Go to diff View file
A plugins/document_generation/scripts/tracker-report-action/src/Exporter/DOCX/TableOfContents/table-of-contents.test.ts +46 −0 Go to diff View file
A plugins/document_generation/scripts/tracker-report-action/src/Exporter/DOCX/TableOfContents/table-of-contents.ts +137 −0 Go to diff View file
A plugins/document_generation/scripts/tracker-report-action/src/Exporter/DOCX/TableOfContents/toc-field-instruction.test.ts +57 −0 Go to diff View file
A plugins/document_generation/scripts/tracker-report-action/src/Exporter/DOCX/TableOfContents/toc-field-instruction.ts +91 −0 Go to diff View file
A plugins/document_generation/scripts/tracker-report-action/src/Exporter/DOCX/sections-anchor.test.ts +31 −0 Go to diff View file
A plugins/document_generation/scripts/tracker-report-action/src/Exporter/DOCX/sections-anchor.ts +24 −0 Go to diff View file
M plugins/document_generation/scripts/tracker-report-action/src/Exporter/download-docx.ts +19 −7 Go to diff View file
M plugins/document_generation/scripts/tracker-report-action/src/type.ts +1 −1 Go to diff View file