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.
RI 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 i
s
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!
***************************
"richi" wrote:
> Hello, i'm hoping that somebody can point me in the right direction with m
y
> 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 retrie
ve
> them when needed. Storing the Word document seems to be no problem but whe
re
> 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 allo
w
> me to crack this problem.
> Many thanks for your guidance in advance.
> R
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.
"Cowboy (Gregory A. Beamer) - MVP" <NoSpamMgbworld@.comcast.netNoSpamM> wrote
in message news:73E83781-6E94-4FAA-9A73-73AF0C1D345C@.microsoft.com...
>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!
> ***************************
> "richi" wrote:
>
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
Thursday, March 29, 2012
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment