View XLSX file from ASP.NET

Discussion in 'ASP .Net' started by Madison, Sep 21, 2009.

  1. Madison

    Madison Guest

    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.
    Madison, Sep 21, 2009
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. David Thielen
    Replies:
    3
    Views:
    78,954
    David Thielen
    May 27, 2008
  2. mavrick_101

    Reading .xlsx

    mavrick_101, Oct 8, 2008, in forum: ASP .Net
    Replies:
    2
    Views:
    463
    Cowboy \(Gregory A. Beamer\)
    Oct 9, 2008
  3. Doogie

    Exporting to Excel (xlsx files)

    Doogie, Nov 19, 2008, in forum: ASP .Net
    Replies:
    3
    Views:
    5,556
  4. Madison

    Upload XLSX file

    Madison, Sep 17, 2009, in forum: ASP .Net
    Replies:
    8
    Views:
    3,527
  5. Parthiv Joshi
    Replies:
    1
    Views:
    644
    Samuel L Matzen
    Jul 6, 2004
Loading...

Share This Page