mirror of
https://github.com/dolanmiu/docx.git
synced 2026-12-01 16:55:59 +01:00
* feat(layout): lay out the .docx files a template imports (w:altChunk) as Word does Word's PDFs of the word-imported-* probes (AC1 to AC16) show what Word does with a .docx a document imports when it opens it: - its body goes where w:altChunk is, in the body, a table cell, a header, a footnote or another imported document, without its section's properties and headers, and with an empty paragraph at its end when it doesn't end with one - a style of the same type and name, whatever its id or the case of its name, is the document's, as are its defaults, theme and settings; a style only it has keeps how it looks there, with new ids where the document has its ids - its lists are lists of their own, and its footnotes are numbered with the document's - a bookmark of a name the document has is the document's patchDocument unzips the .docx files a template imports for the estimator, and the .docx adapter turns them into the template's own before laying it out. An imported document of several sections, one whose formatting is kept (w:matchSrc), one with a page reference or number of pages, and one in another format, such as HTML, RTF or plain text, still stop, now saying why. * feat(layout): keep the look of the styles only an imported document has, as word-imported-styles.docx shows Word's PDF of word-imported-styles.docx (AS1 to AS9) settles how Word keeps the look of an imported document's own styles: - a paragraph style keeps what the styles it is based on there and the imported document's defaults give it, whatever the document's of their names (AS1, AS2, AS4) - a character style keeps only what it gives, not the defaults (AS3) - a table style is based on the document's Normal Table (AS6) - paragraphs of no style are in the imported document's default style (AS5) Where the imported document's defaults leave out some of the document's, which Word's PDFs haven't shown, the layout stops. Keeping source formatting (w:matchSrc) still stops: Word keeps the text's look, but gives the last paragraph none of its space after (AS9), and keeps the document's table defaults and theme (AS7, AS8). * docs: say the imported documents' reader reads all six of the probe's documents The reader's usage comment still said four documents, from before the probe wrote word-imported-bookmarks and word-imported-styles, so following it left those two out. * docs: say the best guess still stops only at the imported documents it doesn't lay out Since the .docx adapter lays out imported .docx files as Word does, a guess only stops at those it doesn't, such as one in HTML, rather than at every imported document. * fix(layout): read backslashes in a relationship's target as slashes, as patchDocument does patchDocument unzips an imported .docx at its relationship's target with backslashes read as slashes, as some tools write them, but the .docx adapter resolved the target as it was written, so it didn't find the document and stopped at it.