View XLSX file from ASP.NET

M

Madison

Hi there,
I have web application for viewing document saved in SQL Server 2005 database.
I can retrieve any file type (PDF, XLS, HTML,...) but not XLSX file. When I
try to open the xlsx file, I got the popup window say "Do you want to open or
save this file?" I picked open then popup window with message say Execl found
unreadable
content in 'viewdocument.aspx'. Do you want to recover the contents of this
workbook? If you trust the source of this workbook, click Yes.
I did click Yes then the other window popup say "Excel cannot open the file
'viewdocument.aspx' because the file format or file extension is not valid.
Verify that the file has not been corrupted and that the file extension
matches the format of the file", now only OK button. I click Ok then nothing
happen. We recently installed update for Office. It only happened to excel
2007 (xlsx), I still open excel with ext xls. Below are my coding for xlsx
file
Response.ClearContent()
Response.ClearHeaders()
Response.Clear()
If dr.Read Then
Response.ContentType =
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
Response.AddHeader("Content-Disposition", "no-cache")
Response.BinaryWrite(dr("doc_image"))
End If
Response.Flush()
Response.End()

Any advise please. Thanks.
 

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,708
Messages
2,569,347
Members
44,654
Latest member
7Jhamal74

Latest Threads

Top