I'm afraid I have extensive experience scripting MS Word. It's not something I like to talk about much, but sometimes the painful memories do surface...
I think the RTF idea is a good one, because it will help you avoid having anything to do with programming Word. But let's just say you wanted to for the sake of argument... These days they're building an entire Visual Basic mini-IDE into word, and you can use VB to access almost every aspect of Word's byzantine feature set through the MSWord DOM, at the COM level. I think the best way to describe it is that this DOM is to object oriented programming what penetrating your forehead with a power drill is to psychotherapy. However, if you manage to claw your way through to getting what you need operating, the next thing you will discover is that VB is mind-bogglingly slow. How slow, you ask? Well, I was processing two-page word documents into a database, XML-izing different parts to preserve formating and storing them into different fields. Trivial. This program wouldn't take more than 200ms to run on any decent system. On MS Word, on my PIII/500, it took 30 *seconds* per document. While it was running, it rendered the computer basically useless, and it couldn't be stopped without killing the task. In theory, it's a great system, and it's trivial to access the database or the filesystem or XML classes alike from inside the word processor. It's very powerful. Microsoft has even written and published a tutorial of sorts where they explain how to go _from_ MSWord to XML using these techniques (it's on MSDN, sorry no URL handy). Although the compiled VB executable in that example crashes on startup... In practice, the implementation is a raving nightmare, and you should avoid it at all costs. Not to mention the security implications of it all, which by now have been well explored to the tune of many billions of dollars in damages worldwide... On Fri, 1 Mar 2002, Stephen Clarke wrote: > Hi all, > > OK. So much for pdf. Does anyone know if there is any way of turning an XML > into MS Word format? I don't think word is scriptable, is it? VBScript, > perhaps? > > Just wondering. > > Sorry. The very thought is rather distastefull , isn't it. But who knows. > > See. Just for fun I did my resume in pdf using fop. But now everybody keeps > asking me for the same thing in MS Word format. Argh. Very annoying. So I > want to be able to change my XML and have it reflected automatically in both > word and pdf. > > This could be a contender for the most twisted idea of all time. > -- > Best > SC. >
