LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.dotnet.framework.aspnet,microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default "Unable to Open File" - excel output of Datagrid <-help needed

I am stuck on this. It ought to be a simple reason as to why this is
problematic, in that it works on smaller groups of data (say under 40
records), but doesn't on larger groups of records (40+).

I'm displaying 9 columns in a datagrid, and have a radiobutton at the top of
the page that says Web, Excel & Word. Web is selected by default. If you
click one of the other two buttons, this code is executed:

Private Sub RbtnExport_SelectedIndexChanged(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles RbtnExport.SelectedIndexChanged

DataGrid1.AllowSorting = False

RbtnExport.Visible = False

btnReset.Visible = False

btnReports.Visible = False

Response.Charset = ""

EnableViewState = False

Dim sFile As String = Session("User") & "-Product List-" & Today()

sFile = sFile.Replace("/", "")

RbtnExport.Visible = False

Select Case RbtnExport.SelectedItem.Value

Case "Excel"

Response.ContentType = "application/vnd.x-msexcel"

Case "Word"

Response.ContentType = "application/msword"

End Select

Response.AddHeader("Content-Disposition", "Attachment; filename=" & sFile &
".xls")

btnReset.Visible = True

btnReports.Visible = True

RbtnExport.Visible = True

DataGrid1.AllowSorting = True

EnableViewState = True

End Sub

The smaller datagrids display fine, but anything more than 40 records
(approx 1K per record), doesn't work. When I save the file, it saves as
whatever.xls, and on a File/Open or a double click, it'll give me an "Unable
to read file." message and an OK box in Excel. You click on OK, and nothing
is loaded.

Small (20-30 records) files (approx 25K) work fine. I do nothing any
different in displaying a 75 record file than I do here, but Excel simply
will not open it.

I have tried several other options, looking at aspone.excel, and also trying
the render html option but that doesn't work - I get an error about a
control being outside a form or something. I even tried a component that
did all that, and all it would ever return is a blank page.



I am at the end of my rope on this one. Would appreciate any help.

SC


 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Unable to open a 82 KB XLSM file due to "Too many different cellformats" & "Converter failed to open the file." errors. Phillip Pi Excel Discussion (Misc queries) 0 April 23rd 09 08:53 PM
Unable to open a 82 KB XLSM file due to "Too many different cellformats" & "Converter failed to open the file." errors. Phillip Pi Setting up and Configuration of Excel 0 April 23rd 09 08:53 PM
Excel unable to importa data from "mdb" file link SFX Excel Discussion (Misc queries) 0 August 23rd 07 01:24 PM
"Unable to Read File" error message in Excel - solutions? Presby Loaner Excel Discussion (Misc queries) 2 June 27th 07 05:09 PM
Insert "-" in text "1234567890" to have a output like this"123-456-7890" Alwyn Excel Discussion (Misc queries) 3 October 25th 05 11:36 PM


All times are GMT +1. The time now is 06:16 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"