I wish to insert/extract a program (python, Java, doesn't matter; it's text) in an MS Word doc. The rest of the MS Word doc can contain essentially anything but with respect to the embedded program there are two requirements:
- You can see (literally) the program in plaintext, so it cannot be an unrenderable binary object that is "stashed" into the doc.
- The program can programmatically (ha!) be extracted or inserted into the doc without scanning or otherwise sniffing, i.e. the program is (if you forgive the analogy) is in a div that unambiguously contains it. Whatever APIs are brought to bear on the program must essentially be of the form
byte[] (or char[]) content = worddoc.getRegionFromDoc("markerOfSomeKind")
Obvious goals are simplicity in insertion/extraction and (best case) raw treatment of characters, i.e. Word doesn't try to apply formatting of any kind.