PC Review


Reply
Thread Tools Rating: Thread Rating: 1 votes, 1.00 average.

Displaying Word & Excel 2007 documents from ASPX

 
 
New Member
Join Date: Jul 2010
Posts: 1
 
      21st Jul 2010
I am loading documents into our Oracle database and then retrieving them for the users to view. So far PDF, DOC, XLS, CSV, etc. all perform as expected, however; DOCX, XLSX, etc. files have one annoyingly persistent issue.

When the document is downloaded by the user and they open it you get the first in a series of messages:

The file 'thefile.docx' cannot be opened because there are problems with the contents.

Details: The file is corrupt and cannot be opened.

and then:

Word found unreadable content in 'thefile.docx'. Do you want to recover the contents of this document? If you trust the source, click Yes.

After clicking yes the file opens and all of the content appears correct. Including images, formatting, tracked changeds and comments, equations, etc.

I have tried multiple methods along these lines to no avail. I simply want the files to open without the false-positive error messages.

I am using VS2010, with the website targeted at .Net Framework 2.0.

objConn = NewOracleConnection(gstrConnectionString)

objConn.Open()

cmd =
NewOracleCommand

cmd.Connection = objConn

cmd.CommandText =
"select DOCUMENT_NAME,DOCUMENT_TYPE,DOCUMENT from FTP_PERMIT_DOC where PERMIT_ID='" & strPermitID & "' and AMENDMENT_ID='" & strAmendmentID & "' and DOCUMENT_ID='" & strDocumentID & "'"

dr = cmd.ExecuteReader

dr.Read()

Dim blob AsOracleBlob = dr.GetOracleBlob(2)

@

Response.Clear()

Response.ContentType = dr(
"DOCUMENT_TYPE")

Response.AppendHeader(
"Content-Disposition", "attachment;filename=" + dr("DOCUMENT_NAME"))

Response.BinaryWrite(blob.Value)

Response.End()

Response.Flush()



If anyone has any idea on how to avoid these annoying messages I would love to hear it!

-Tim
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Read/write excel and word 2007 documents from another application mco3006 Microsoft Excel Misc 0 27th Apr 2010 10:18 AM
OFFICE 2007 (Word, Excel, PowerPOint) LOSING RECENT DOCUMENTS LIST jfguerra Microsoft Word Document Management 9 5th Sep 2009 05:04 PM
delete recent documents history in word and excel 2007 ted Microsoft Excel Misc 1 22nd Aug 2008 02:02 PM
Problems displaying Excel on aspx page =?Utf-8?B?U3R1YXJ0?= Microsoft ASP .NET 5 5th Jan 2007 06:28 AM
displaying word documents in IE John P. Pignotti Microsoft Word Document Management 0 26th Aug 2004 05:41 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:53 PM.