I have no exact answer for what you want to do. However, you might consider creating an entire document on your server.
MS Excel 97 supports the creation of a simple XML or HTML file (with tables) and simply calls the something-uniqueid.xls file
It is possible that MS Word also does something similar. Take any basic HTML file (use the <h1> <h2> <u> tags to get started) and change the name to something.doc . See if Word opens it with a double click.
If this works, you can serve the entire document as an html file, but tell the client that it is called something-unique-id # .doc
To do this, to work from the web server, you will need to set the HTTP headers Content-type: application/msword and Content-disposition: Attachment; filename=something-unique-id.doc Content-disposition: Attachment; filename=something-unique-id.doc
Please check the MIME type for msword .. I'm not sure if this is correct.
Last but not least, to make sure to 100% try using URLs with the most recent GET variable set to .doc , this means your URL should look like /listing.asp?var1=abc&var2=def&output=.doc
This was necessary nine years ago to ensure 100% browser coverage. You will need to check is still required.
source share