Opening word documents stored in SQL Server using ASP.Net

G

Guest

Hello, i'm hoping that somebody can point me in the right direction with my
problem.

I have been tasked with creating a simple browser based application that
will allow the user to upload Word documents to SQL Server and then retrieve
them when needed. Storing the Word document seems to be no problem but where
I am stuck is on retrieving them and then displaying the Word documents as
through ASP.NET it will be on the server i think.

Does anybody know of any articles, best practices or advice that will allow
me to crack this problem.

Many thanks for your guidance in advance.

R
 
G

Guest

I am sure there are some articles. The basic of outputting as a different
type is changing the mime type of the response. To get the document out, you
will stream directly to HTTP, as it is the most efficient. What this means is
the display page is an ASPX without any ASPX tags (just the @ directive) and
you will be manipulating the type in the response header in your CodeBehind.

In addition, you may have to set up IIS to recognize Word as a valid MIME
type.

---

Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

***************************
Think Outside the Box!
***************************
 
E

Eliahu

On your aspx page that's supposed to show the word document write:

<%@ Page language="c#" Codebehind="ExportToWord.aspx.cs"
AutoEventWireup="false" Inherits="WebTry001.Graph.ExportToWord" %>
<% RenderWordData (); %>

and on the code-behind write:

protected void RenderExcelData ()
{
Response.ContentType = "application/ms-word";
Response.AddHeader("Content-Disposition",
"inline;filename=MyReport.doc");

//here save the content of your document to Response.OutputStream ...

}

hope it helps.
 
G

Guest

Many thanks for your help.

If anybody knows of any documents or sample applications to look at I would
be gratefull if you could provide the URL.

Thanks

R
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,756
Messages
2,569,533
Members
45,007
Latest member
OrderFitnessKetoCapsules

Latest Threads

Top