Solved

How to save the content as .doc file from the browser?

Posted on 2001-09-07
10
159 Views
Last Modified: 2008-03-10
I want to give an option in my site where the user can save the content of the page as a .doc file where ever he/she is browsing. Is there any way in javascript with which i can do this?
0
Comment
Question by:softganesh
  • 3
  • 2
  • 2
  • +3
10 Comments
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 6464261
Not natively.

With activeX you might...

Michel
0
 
LVL 46

Accepted Solution

by:
fritz_the_blank earned 50 total points
ID: 6464680
You can do it this way, but it is not a very good idea to do so:

<%@ Language=VBScript %>
<%Response.Buffer = True%>

<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<TITLE></TITLE>
</HEAD>

<%
'This codes assumes the existence of a folder named "HTMLConvert" on the desktop
'It will be neccessary to change the path when implemented
dim strDocName, strFileName
strDocName = Request("DocName")
dim WordApp
set WordApp = CreateObject("Word.Application")
WordApp.visible = false
strFileName = strDocName + ".htm"
Response.Write(strDocName + "<br>")
Response.Write(strFileName)
WordApp.Documents.Open("C:\windows\desktop\HTMLConvert\" + strFileName)
numChars=WordApp.ActiveDocument.Characters.Count
set myrange = WordApp.ActiveDocument.Range(0,numChars-20)
myrange.select
WordApp.Selection.Copy
WordApp.ActiveDocument.close
WordApp.Documents.add
WordApp.Selection.paste
strFileName = strDocName + ".doc"
WordApp.ActiveDocument.SaveAs("C:\windows\desktop\HTMLConvert\" +strFileName)
WordApp.ActiveDocument.Close
WordApp.Quit
set WordApp = Nothing
Response.Redirect(strFileName)
%>

</SCRIPT>
<BODY>


</BODY>
</HTML>
0
 
LVL 9

Expert Comment

by:msdixon
ID: 6464745
you can generate it with server-side script like asp, but not client-side javascript.
0
 

Author Comment

by:softganesh
ID: 6470290
My application is working in Oracle web server. So I can't use ASP.

Atleast, is there any way to do the same i.e., saving as .htm using javascript to the client machine?
0
 

Author Comment

by:softganesh
ID: 6470307
My application is working in Oracle web server. So I can't use ASP.

Atleast, is there any way to do the same i.e., saving as .htm using javascript to the client machine?
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 12

Expert Comment

by:ahosang
ID: 7967875
This question has been abandoned. I will make a recommendation to the moderators on its resolution in a week or so. I appreciate any comments that would help me to make a recommendation.
 
In the absence of responses, I may recommend DELETE unless it is clear to me that it has value as a PAQ. Silence = you don't care
 
ahosang
0
 
LVL 46

Expert Comment

by:fritz_the_blank
ID: 7968224
Split between me and Michel or to Michel only.

Fritz the Blank
0
 
LVL 12

Expert Comment

by:ahosang
ID: 8029226
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

SPLIT - mplungjan/fritz_the_blank
Please leave any comments here within the next seven days.
 
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
 
ahosang
EE Cleanup Volunteer
0
 
LVL 5

Expert Comment

by:Netminder
ID: 8092877
Per recommendation, force-accepted.

Netminder
EE Admin

mplungjan: points for you at http://www.experts-exchange.com/Web/Web_Languages/JavaScript/Q_20543176.html
0
 
LVL 46

Expert Comment

by:fritz_the_blank
ID: 8093674
Thank you,

Fritz the Blank
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Avoid defining the variables in the global scope; trying to define them in a local function scope. Because:   • Look-up is performed every time a variable is accessed.   • Variables are resolved backwards from most specific to least specific scope…
This article will give core knowledge of JavaScript and will head in to your first JavaScript program. I am Durvesh Naik and I am here to deal with this series of JavaScript. I will teach you JavaScript in part wise , as its quite boring to read big…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

912 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now