[{"data":1,"prerenderedAt":248},["ShallowReactive",2],{"lit-docx-doc:\u002Fen\u002Fguide\u002Fround-trip":3},{"id":4,"title":5,"body":6,"description":233,"extension":234,"keywords":235,"locale":239,"meta":240,"navigation":241,"order":242,"path":243,"section":244,"seo":245,"stem":246,"__hash__":247},"docs\u002Fguide\u002Fround-trip.en.md","Round trips and preservation",{"type":7,"value":8,"toc":220},"minimark",[9,30,35,40,43,47,65,76,80,87,103,106,110,135,138,142,149,199,202,206],[10,11,12,13,17,18,21,22,24,25,29],"p",{},"A round trip means reading a file with ",[14,15,16],"code",{},"parseDocx",", optionally changing the LitAST, and writing it back with ",[14,19,20],{},"generateDocx",". ",[14,23,20],{}," always ",[26,27,28],"strong",{},"rebuilds the whole package"," from LitAST rather than patching the original ZIP, so what can be written back depends on what the LitAST holds.",[31,32,34],"h2",{"id":33},"three-kinds-of-preservation","Three kinds of preservation",[36,37,39],"h3",{"id":38},"rebuilt-from-meaning","Rebuilt from meaning",[10,41,42],{},"Recognized content (paragraphs, text formatting, tables, images, headers and footers, fields, content controls, comments, tracked changes and more) becomes the matching nodes, and OOXML is generated again from those nodes on write. Change the nodes and the change appears in the output file.",[36,44,46],{"id":45},"elements-kept-verbatim","Elements kept verbatim",[10,48,49,50,53,54,57,58,61,62,64],{},"Unrecognized elements become ",[14,51,52],{},"unknownBlock"," (block-level) or ",[14,55,56],{},"unknownInline"," (inline) nodes with their original structure stored in ",[14,59,60],{},"rawXml",", and are written back unchanged. ",[14,63,60],{}," is an internal serialization, not an XML string; do not edit it by hand.",[10,66,67,68,71,72,75],{},"Passing ",[14,69,70],{},"preserveRawXml: false"," when parsing drops these elements. Equations (OMML) are always kept in their original structure inside ",[14,73,74],{},"math"," nodes, regardless of this option.",[36,77,79],{"id":78},"parts-kept-verbatim","Parts kept verbatim",[10,81,82,83,86],{},"These parts are stored in ",[14,84,85],{},"ast.meta.rawXmlFiles"," and written back unchanged:",[88,89,90,94,97,100],"ul",{},[91,92,93],"li",{},"Styles, numbering definitions, document settings, the font table and the theme",[91,95,96],{},"Core and custom properties",[91,98,99],{},"Comments, their extension parts and the comment people list",[91,101,102],{},"Footnotes and endnotes",[10,104,105],{},"Chart source data (chart parts and embedded workbooks) is also kept and written back, but charts cannot be created or edited through LitAST.",[31,107,109],{"id":108},"phonetic-guides","Phonetic guides",[10,111,112,115,116,119,120,123,124,127,128,131,132,134],{},[14,113,114],{},"ruby"," writes native ",[14,117,118],{},"w:ruby",", with base text in ",[14,121,122],{},"children"," and annotation in ",[14,125,126],{},"attrs.rubyText",".\nEdited text or modeled properties use their current values. Unchanged ordinary run formatting,\nunmodeled rubyPr properties and explicit zero\u002Ffalse values are kept in ",[14,129,130],{},"_rubyPreservation",";\ndo not edit this internal source record. ",[14,133,70],{}," does not disable it.",[10,136,137],{},"Content with relationships or range identities does not replay stale XML. A link around the\nwhole ruby uses the shared relationship allocator; links inside either text layer violate the\nOOXML ruby content model and are rejected on export. Complete lifecycles for nested fields,\ncomments and revisions remain unverified. Reopening, editing and saving were checked in Word\n16.109.2; ordinary horizontal display was checked in WPS 12.1.28496. Other producers and\ncomplex combinations remain unverified; cross-producer fidelity is not guaranteed.",[31,139,141],{"id":140},"what-is-lost","What is lost",[10,143,144,145,148],{},"The following are currently ",[26,146,147],{},"not"," kept through a round trip:",[150,151,152,165],"table",{},[153,154,155],"thead",{},[156,157,158,162],"tr",{},[159,160,161],"th",{},"Content",[159,163,164],{},"Notes",[166,167,168,181,191],"tbody",{},[156,169,170,174],{},[171,172,173],"td",{},"Building blocks (glossary)",[171,175,176,177,180],{},"Recorded in ",[14,178,179],{},"rawXmlFiles.glossaryXml"," when read, but not written back",[156,182,183,186],{},[171,184,185],{},"Custom XML parts",[171,187,176,188,180],{},[14,189,190],{},"ast.meta.customXmlParts",[156,192,193,196],{},[171,194,195],{},"Any other part not listed above",[171,197,198],{},"Not copied into the output",[10,200,201],{},"If your use case depends on any of these, check the output file after writing.",[31,203,205],{"id":204},"saving-litast","Saving LitAST",[10,207,208,209,212,213,216,217,219],{},"LitAST can be saved with ",[14,210,211],{},"JSON.stringify",". After ",[14,214,215],{},"JSON.parse"," it can still be passed to ",[14,218,20],{},", and verbatim content is written back with it.",{"title":221,"searchDepth":222,"depth":222,"links":223},"",2,[224,230,231,232],{"id":33,"depth":222,"text":34,"children":225},[226,228,229],{"id":38,"depth":227,"text":39},3,{"id":45,"depth":227,"text":46},{"id":78,"depth":227,"text":79},{"id":108,"depth":222,"text":109},{"id":140,"depth":222,"text":141},{"id":204,"depth":222,"text":205},"When a DOCX is read and written back, what is rebuilt from meaning, what is kept verbatim, and what is lost.","md",[236,237,60,52,238],"round trip","preservation","loss","en",{},true,4,"\u002Fen\u002Fguide\u002Fround-trip","Guides",{"title":5,"description":233},"guide\u002Fround-trip.en","JrvGSjsQoDlVT4qHpDGm5hEaIX6UPUebOsEpkAaq3do",1793045343968]