Jump to content


 


Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.


Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.

Photo

Save Ie7 Web Page As A Word File


  • Please log in to reply
6 replies to this topic

#1 Baptong

Baptong

  • Members
  • 14 posts
  • OFFLINE
  •  
  • Local time:09:29 AM

Posted 22 September 2008 - 02:01 PM

I am using this document.execCommand('SaveAs') and when I do document.execCommand('SaveAs', 'true', 'word_file.doc'), nothing happens. Anyone know how to save Web page as a Word document? Either as DOC or DOCX file extension.

BC AdBot (Login to Remove)

 


m

#2 groovicus

groovicus

  • Security Colleague
  • 9,963 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Centerville, SD
  • Local time:08:29 AM

Posted 22 September 2008 - 03:34 PM

You are using the right syntax. What does the rest of your code look like?

#3 Baptong

Baptong
  • Topic Starter

  • Members
  • 14 posts
  • OFFLINE
  •  
  • Local time:09:29 AM

Posted 22 September 2008 - 04:32 PM

Well, to make it simple, my code looks like this in a nutshell

<html>
<head>
<title>
</title>
<script language="Javascript">
function save_as()
{
document.execCommand('SaveAs', 'true', 'word_file.doc')
}
</script>
<body>
<input type="button" value="Save Form to the Local PC" onClick="save_as()"></input>
</body>
</html>

That button does not function nor does it bring up the Save As window.

#4 groovicus

groovicus

  • Security Colleague
  • 9,963 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Centerville, SD
  • Local time:08:29 AM

Posted 22 September 2008 - 04:37 PM

The code looks fine. So the stupid question is are you trying to run it in Firefox with script block on or anything like that?

#5 Baptong

Baptong
  • Topic Starter

  • Members
  • 14 posts
  • OFFLINE
  •  
  • Local time:09:29 AM

Posted 22 September 2008 - 04:43 PM

No, I am running it in Microsoft IE 7. Have you tried my code yourself? I am hoping it may be a user error on myself.

#6 groovicus

groovicus

  • Security Colleague
  • 9,963 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Centerville, SD
  • Local time:08:29 AM

Posted 22 September 2008 - 04:47 PM

I am getting this error:

Error: uncaught exception: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIDOMNSHTMLDocument.execCommand]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: file:///C:/Users/Public/Documents/test.html :: save_as :: line 8" data: no]

#7 Baptong

Baptong
  • Topic Starter

  • Members
  • 14 posts
  • OFFLINE
  •  
  • Local time:09:29 AM

Posted 22 September 2008 - 04:59 PM

Well, that is ODD.........

When I run it in IE 7, I had to allow the blocked content, and then I click on my button and nothing happens. Anyone else know something else? Or maybe even another forum where I can ask.

Edited by Baptong, 22 September 2008 - 05:12 PM.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users