Such as I have a office word file named file.docx
.It have some text in it,Such as
I have a dfj.
This is second line.
Ok. I know that already.
Then I want to add some string into the place that the arrow pointting by MMA.Is it possible?
Mathematica Stack Exchange is a question and answer site for users of Wolfram Mathematica. It only takes a minute to sign up.
Sign up to join this communityAs this comment,I realize I can Save As my .doc file into .xml file.Then process it
file = Import["C:\\Users\\zyd199012\\Desktop\\file.xml"]
Export["file2.xml",
Replace[file,
"This is second line." :> "This is second Some Text line.",
Infinity]]
Then Save As it back into .docx file. Of course,if someone know how to use MMA convert the .docx file into a .xml file,the answer is expected still.
.xml
,then I import some XMLObject.That's confusing.. $\endgroup$ – yode Sep 5 '17 at 2:56Import["file.docx", "word\\document.xml"]
(unfortunately I do not have Office or a *.docx file for testing). $\endgroup$ – J. M.'s ennui♦ Sep 5 '17 at 3:24