In short: I'm looking for a way for a (known) UUID to be associated with a paragraph and/or text run.
I'm using dolanmiu/docxjs for exporting docx, and was extending the Paragraph and TextRuns to add my own metadata (uuids) on export. And have them stay in the docx after saving in MS Word, Google Docs, LibreOffice.
I have control over the exported xml, and on import convert docx to xml to parse. But I have control over what editor is used between export and import to edit the docx.
I've tried custom/arbitrary metadata on the paragraph / textrun level. As well as custom node types, but these all seem to be stripped on save.
The solution doesn't need to be inline with the document.xml, as I have seen some articles about having a separate custom.xml of data to be part of the docx, but I'm not sure how to relate a TextRun to it's uuid in the separate file (syntax wise in document.xml especially).
I came across this link: Is it possible to add some data to a Word document? , but that seems to be metadata at the document level and not more granular to the paragraph / text nodes.
Things I've tried:
- tried adding custom arbitrary namespace (may have done it wrong) stripped out on save
- tried adding custom nodes: stripped
- tried adding custom attributes: stripped
- tried using bookmarkStart/bookmarkEnd: some stripped, some moved, some didn't allow text inbetween start and end, some changed the id (which i was using as the uuid value)
- tried the OOXML custom, but it was stripped: http://ooxmlisdefectivebydesign.blogspot.com/2008/03/custom-xml-what-custom-xml.html https://c-rex.net/projects/samples/ooxml/e1/Part4/OOXML_P4_DOCX_Custom_topic_ID0E3FBS.html
Is there a way to add this custom metadata at a paragraph / text level in a docx that won't be stripped when edited and saved by a word processor?