Click to See Complete Forum and Search --> : save word instance document to client side [ASP]


hfelix
April 24th, 2003, 10:55 AM
Hi...

I want to create a instance of word on server-side, i put some values into that document and i want to the client with a click on a link can download the content of that instance in format of a word document (.doc).

***note: I dont want to save a file on server and then download.


Set WordApp = server.CreateObject("word.application")
Set WordDoc = WordApp.Documents.Add()


OK. I create a instance of Word App, I add a document to my word application.

And now... how can i save my document to client side, without first save my file into server-side???

Thankx...
HFelix

Satishpp
April 24th, 2003, 11:26 AM
I would suggest using

Response.ContentType = "application/vnd.ms-word"

This will open your HTML documents as a word document on the client.

Here is an example
http://www.codeave.com/asp/code.asp?u_log=129

Satish

hfelix
April 24th, 2003, 11:54 AM
OK. is a way....

I want to create a Instance on server-side... insert text on that instance... and create a link to client make a download of the content of that instance.

***Note: to do the example that you show me, the client need to have MS Word installed.

Thankx... anyway
HFelix

Satishpp
April 24th, 2003, 12:57 PM
In that case, I cant think of a way to do this without saving the file to disk even temporarily.

If you come across a solution, do let us know.

Satish

Satishpp
April 24th, 2003, 01:12 PM
However, if you are OK with saving the file to disk for a few seconds / milliseconds, this link should show you a way.


http://www.experts-exchange.com/Web/Web_Languages/ASP/Q_20316924.html

Let me know if you need any explaination

Satish

fizch
April 29th, 2003, 03:20 PM
I don't know that the DOM will allow you to create a file on the client system. That is a major security hole.

hfelix
April 29th, 2003, 04:20 PM
The file will be placed in Client side like a download. the client will "say" if want that file or not...

When the client "click" over a link the file will be pass with client autorization.

fizch
April 29th, 2003, 04:59 PM
Have you seen this done before?

hfelix
April 29th, 2003, 05:06 PM
Never...

This is for a work to school... and the teatcher want the work made by this way...

He say that is possible... but he dont say how we can do that.

Thankx aniway
HFelix

Satishpp
April 29th, 2003, 05:31 PM
Do it like this

-----------------------
<%
Response.AddHeader "content-disposition","attachment; Response.ContentType = "application/MS-word"
Response.binarywrite "some text"
response.end
%>
----------------------

Copy this code to a .asp file and call it from the browser. You should get a file download dialogbox.

Satish

hfelix
May 6th, 2003, 11:39 AM
Hi... the work is finished!!!

To this problem... what i do?

I store my document in server hard disk, i i download that to the client wiht:
-------------------
filepath = server.mapPath ( "./templates/" & "filename" )
response.redirect ( filepath )
-------------------

The real solution for the problem... that i've not do it, passes trought... create a instance of word application, export to outlook, create a mail acount in outlook, start sending a mail with the document pasted in the the mail, ok... we have the mime-type, we need to interrupt the mail sending, get the mail attach and then send it to the client as a download...

Yes, it's for Insanes.

Tanhkx for all the help that all you gave me...

HFelix