Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    Mar 2007
    Posts
    98
    Thanks
    24
    Thanked 4 Times in 4 Posts

    create new word document?

    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:

    Code:
    document.all.txtaDocument.value += strDocument
    document.all.txtaDocument.select()
    txttoCopy = document.all.txtaDocument.createTextRange()
    txttoCopy.execCommand("copy")
    I am also able to open a new IE window and populate with the doc:

    Code:
    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.

  • #2
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,537
    Thanks
    77
    Thanked 4,381 Times in 4,346 Posts
    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.

  • #3
    New Coder
    Join Date
    Mar 2007
    Posts
    98
    Thanks
    24
    Thanked 4 Times in 4 Posts
    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.

  • #4
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,537
    Thanks
    77
    Thanked 4,381 Times in 4,346 Posts
    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?


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •