473,396 Members | 2,151 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

How to open a word document saved in sql server in asp.net

Hi All

I've saved a word document in sql server database.I'm able to retrieve
it from the database and open it in a word application.
My problem is as i have to use this in an intranet application, the
word is not opening in a client machine but it is opening on the
machine the application has been hosted.

I'm extracting the word file from database and storing it on the hard
disk and in the next instance passing the file location to the shell
command and opening it.

please try to solve my problem asap.

Jeff

Jul 6 '06 #1
4 5492
One (of many) solutions:
when the document is retrieved from the database, save it to a temporary
file on the webserver. Then have the webpage redirect to the file. This
will cause the Word document to be opened in the web browser.

<je*****@gmail.comwrote in message
news:11**********************@v61g2000cwv.googlegr oups.com...
Hi All

I've saved a word document in sql server database.I'm able to retrieve
it from the database and open it in a word application.
My problem is as i have to use this in an intranet application, the
word is not opening in a client machine but it is opening on the
machine the application has been hosted.

I'm extracting the word file from database and storing it on the hard
disk and in the next instance passing the file location to the shell
command and opening it.

please try to solve my problem asap.

Jeff

Jul 6 '06 #2

Thank u Brendan for the suggestion. I've already tried this one. Its
working on the server but not on the client. If you have any other
solution try to post it.
I've used response.binarywrite also.

Jeff

Jul 6 '06 #3

<je*****@gmail.comwrote in message
news:11**********************@v61g2000cwv.googlegr oups.com...

You may try this:

byte[] btYourDoc;
btYourDoc = GetYourDocDataFromSqlServer();
Response.ContentType = "application/ms-word";
Response.AddHeader("Content-Disposition",
"attachment;filename=yourfilename.doc");
Response.BinaryWrite(btYourDoc);
Response.End();
Hi All

I've saved a word document in sql server database.I'm able to retrieve
it from the database and open it in a word application.
My problem is as i have to use this in an intranet application, the
word is not opening in a client machine but it is opening on the
machine the application has been hosted.

I'm extracting the word file from database and storing it on the hard
disk and in the next instance passing the file location to the shell
command and opening it.

please try to solve my problem asap.

Jeff
Jul 6 '06 #4
Hi Danny

Thanx for the code.its working
Danny wrote:
<je*****@gmail.comwrote in message
news:11**********************@v61g2000cwv.googlegr oups.com...

You may try this:

byte[] btYourDoc;
btYourDoc = GetYourDocDataFromSqlServer();
Response.ContentType = "application/ms-word";
Response.AddHeader("Content-Disposition",
"attachment;filename=yourfilename.doc");
Response.BinaryWrite(btYourDoc);
Response.End();
Hi All

I've saved a word document in sql server database.I'm able to retrieve
it from the database and open it in a word application.
My problem is as i have to use this in an intranet application, the
word is not opening in a client machine but it is opening on the
machine the application has been hosted.

I'm extracting the word file from database and storing it on the hard
disk and in the next instance passing the file location to the shell
command and opening it.

please try to solve my problem asap.

Jeff
Jul 6 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Martin Lucas-Smith | last post by:
I am trying to use PHP's COM support to open a URL from within MS Word then save the document. I am using PHP5.0.3/Apache2/WindowsXP. phpinfo() confirms that COM support is enabled. ...
8
by: Asma | last post by:
Dear Sir, I am trying to find a way to open a Word document using C language and read the text of word doc into a variable. (Turbo C on Dos 6.0). Can anyone please tell me which libraries in...
1
by: ram | last post by:
how do I open a word document within a webform? I need to open the document within the form so the user can edit the document and then click on a button on the form (so that the document is...
0
by: kstriyhon | last post by:
i need to build a word document from a sql 2000 database and i need this word document to be saved in the client machine not in the server. is this possible?? how can i do this? i mean i need...
1
by: fab | last post by:
Hi, I'm developping a web-application on an intranet. I've got a datagrid with a button on each line. Each line represents a document (MS Word doc). These documents are on a share so that they...
0
by: jefftim | last post by:
Hi All I've saved a word document in sql server database.I'm able to retrieve it from the database and open it in a word application. My problem is I'm able to open it in server/client machines...
0
by: Niyazi | last post by:
Hi, I created application that store the data in SQL SERVER that reside on network. The client also use this application to access the resources provided with application. But is the client want...
2
by: jefftim | last post by:
Hi All I've saved a word document in sql server database.I'm able to retrieve it from the database and open it in a word application. My problem is I'm able to open it in server/client machines...
7
by: Peter | last post by:
ASP.NET 2.0 I am trying to open a Word document and Excel document from a dialog web page, what's the best way to do that? I have tried the following: Response.Clear();...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.