Read / write MS Word files


Does anyone know of a plugin / class / other way to read and write MS Word documents on Mac and Windows? I need to be able to read the file, search and replace content and then save it out to a new Word file.


Check WordFileMBS class.
Can replace placeholders or get/set the xml inside.

[quote=460460:@Christian Schmitz]Check WordFileMBS class.
Can replace placeholders or get/set the xml inside.[/quote]
Thanks Christian, do you have any examples of setting the style in the text that is sent back to the output file?

Would the style not be set around the replacement text/markers which is then retained when you replace it?

We have no example for styles. But of course if the plugin gives you the XML, you can do whatever you like with it.

Is this just reading then document.xml within the docx? Is it possible to read the style.xml using your plugin?

XML(part as String) as String

this function may help.

Is it possible to create a new xml file within the docx file using the MBS class’s as i am really struggling to see how to do this

Being able to read and write the XML files isnt quite the same as being able to read and write a Word Document
There are several in a docx zip file and you need to have them all in sync otherwise you end up with a corrupt docx that Word wont open and you can make Word crash in some cases (such fun !)