0

I am using visual studio 2005 and sql server 2005 to make an application.

I want to save user's doc,docx file in a database and show the uploaded user doc ,docx file in an asp page.

How to achieve this ?

Matthieu
  • 4,605
  • 4
  • 40
  • 60
C J
  • 429
  • 1
  • 10
  • 34

1 Answers1

1

You cannot easily show Word documents in a web browser.

You should show a link to the file - this will download it to the client machine and open it in Word if they have it installed.

I guess you might also consider converting the file to a format that is slightly easier to display in a browser. eg PDF. You can use Office interop to do this or Aspose.Words to do it without Office.

Community
  • 1
  • 1
Geoff Appleford
  • 18,538
  • 4
  • 62
  • 85
  • so i must convert a user doc,docx file into pdf file and then dump it in sqlserver and while retrieving it i can use pdf reader to display it – C J Dec 15 '10 at 12:47
  • Yes, just about every computer has a pdf reader installed and if not, they are freely available. However you are essentially doing the same thing as downloading the doc file to view in Word, only its a PDF to view in Abobe reader. The only real benefit here is that more users are likely to have a PDF reader than word installed. – Geoff Appleford Dec 15 '10 at 13:07
  • i am able to convert this binary data into rtf file can u suggest any rtf reader for asp page – C J Dec 15 '10 at 17:35
  • @user404305 There is no built in way to view RFT files in a browser. See http://stackoverflow.com/questions/678192/is-it-possible-to-display-an-rtf-file-inside-a-web-page-using-php You might want to consider using silverlight to display your files. SL 4 has a built in Rich Text editor but you'll need to write the logic to convert docx/rtf files into the correct format. See http://wordtoxaml.codeplex.com/. Devexpress's DXRichEdit can view docx.rtf files. Demo: http://demos.devexpress.com/DXRichEditSilverlightDemos/. Its not free but I'm sure there are other open source options out there. – Geoff Appleford Dec 16 '10 at 09:26