Answer the question
In order to leave comments, you need to log in
How to edit .doc with JavaScipt?
I created a template in the outdated .doc format and introduced markers like this: {name} {date} , etc.
Can these markers now be programmatically replaced with something of my own? Right in the browser, without involving the server.
Answer the question
In order to leave comments, you need to log in
I found a way to do text replacement in a .doc
format document.
The bottom line is that if we open .doc as plain text, we will see only crocozyabrs, but this does NOT apply to macro code, if they (macros) are of course in the document. Accordingly, we write a self-starting macro for auto replacement using our markers, and then we stupidly replace these markers with the data we need.
The only minus here is that all markers must be of a fixed length, i.e., after editing, the length of the document should not change, but this limitation is easily circumvented by adding spaces.
PS In JavaScript, you cannot edit a .doc file as a string, it gets corrupted by this, but you can overtake it in Uint8Arrayand work with him.
Now it remains to introduce a macro into this template, which will do the replacement and pull it programmatically.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question