View Full Version : create new word document?

04-15-2009, 12:34 AM
Hi all,

Firstly thanks for all the help I've received from you guys, I'm learning so much faster with your help.

I've posted several messages concerning a program I am working on which uses a webform to create a document at the end.

So far I am able to create the doc and copy to clipboard for pasting using the code:

document.all.txtaDocument.value += strDocument
txttoCopy = document.all.txtaDocument.createTextRange()

I am also able to open a new IE window and populate with the doc:

var w = window.open();
w.document.write("<html><body style='font-family: courier new;'><pre>" + strDocument + "</pre></body></html>");

What I would like to do is create a new word doc and populate it with the created document. I've tried with no success using activeX etc. The best I could do was to open an existing word doc, but could not populate it. I need it to open a new blank word window, as it is not practical to have a specified word file already there.

Any help would be appreciated.

Old Pedant
04-15-2009, 02:31 AM
I don't think you can do this from the browser. I'm afraid you may have to do this server-side. And that means running on a windows-based server, no doubt.

How far did you get using new ActiveXObject( )??? If it works, that would have to be the route you'd go.

04-15-2009, 03:13 AM
Thanks for the reply. I was afraid that I would have to go server side for this, which I could do, but was hoping not to, as the whole purpose of this project was that it would be primarily client side.

I must admit I don't quite understand why it wouldn't work though. I'll keep playing with activeX and see what I can do.

Old Pedant
04-15-2009, 03:36 AM
Show some of your ActiveX code, so we can at least see if you seem to be on right track.

You *do* know that the object WILL be marked "unsafe for scripting", so your clients will have to have your site in their "most trusted" security list *and* still permit the scripting on each use?