Save As Word document using execCommand

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • zaidalin79
    New Member
    • Nov 2006
    • 59

    Save As Word document using execCommand

    Hi all, I am trying to add a button to my webpage that opens the save as dialog box, and allows the users to save the page (it is a form) as a word doc... I used this code which does work, but only allows to save as a txt or html file... Is there any way to make it so that they can save it as a .doc file to be able to edit it later?

    [HTML]<input type="button" value="Save Form" onClick="javasc ript: document.execCo mmand('SaveAs', '1','EvalForm') ;"/>[/HTML]
    Last edited by acoder; Jun 29 '07, 08:58 AM. Reason: code in proper tags
  • zaidalin79
    New Member
    • Nov 2006
    • 59

    #2
    SaveAs Button Script

    Hi all, I am trying to add a button to my webpage that opens the save as dialog box, and allows the users to save the page (it is a form) as a word doc... I used this code which does work, but only allows to save as a txt or html file... Is there any way to make it so that they can save it as a .doc file to be able to edit it later?

    Code: ( text )

    1.
    <input type="button" value="Save Form" onClick="javasc ript: document.execCo mmand('SaveAs', '1','EvalForm') ;"/>

    Comment

    • r035198x
      MVP
      • Sep 2006
      • 13225

      #3
      Originally posted by zaidalin79
      Hi all, I am trying to add a button to my webpage that opens the save as dialog box, and allows the users to save the page (it is a form) as a word doc... I used this code which does work, but only allows to save as a txt or html file... Is there any way to make it so that they can save it as a .doc file to be able to edit it later?

      Code: ( text )

      1.
      <input type="button" value="Save Form" onClick="javasc ript: document.execCo mmand('SaveAs', '1','EvalForm') ;"/>
      Moved to Javascript forum

      Comment

      • acoder
        Recognized Expert MVP
        • Nov 2006
        • 16032

        #4
        Being non-standard code, it'd difficult to say for certain, but I think you'll probably have to do something server-side and let the user download it instead. That's actually better, because it would work in more browsers rather than just IE.

        Comment

        • acoder
          Recognized Expert MVP
          • Nov 2006
          • 16032

          #5
          I've merged the threads and changed the thread title.

          Comment

          Working...