Generating Excel with HTML

E

Evan T. Basalik

In my ASP.NET application, I have a table (really a datagrid) that I am
converting into an Excel sheet using ContentType =
"application/vnd.ms-excel". It seems to work fine for most of my results,
but if my table gets too long, I get a message saying "Excel is unable to
read the file".

Any ideas? Is there a fixed limit on the size of the table that can be sent
to Excel in this fashion?

Thanks,

Evan
 
K

Ken Cox [Microsoft MVP]

Hi Evan,

Excel's specifications have a maximum limit of 65,536 rows by 256 columns .

Is it possible that your large table is hitting the row limit?
 
S

Steven Cheng[MSFT]

Hi Evan T. Basalik,

Thank you for using Microsoft Newsgroup Service. Based on your description,
you used a table(DataGrid) to generate the datas and output them as a Excel
table in a ASP.NET webpage. However, you found that sometimes the
converting will fail for some unknown reason, is my understanding correct?

If so, here is my sueestion:
1. What about the quantity of the table's data when the converting failed.
Does your large table hit the row limit of a normal excel worksheet as Ken
Cox mentioned?

2. Is there anything different on the table's data format or other format
on the table(DataGrid) from those ones which didn't cause error?

Please have a check on the above items and if you still feel unclear on it
, would you please provide a simple html code for the certain table that
can cause the converting fail? Thus, I can do some further research on it.
Also, if you have any new findings please also let me know.

Merry Christmas!

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 
G

Guest

Actually, it turns out that none of those were the problem. The datagrid on my page had viewstate enabled. By turning that off, it solved the problem. Could having that turned out overloaded something in the conversion process

Evan
 
S

Steven Cheng[MSFT]

Hi Evan,


Thanks for your followup. I'm glad that you've figured out the problem
yourself. As for the further information you mentioned, I agree with you
that the problem is likely to caused by the ViewState. Since when convert
web page into Excel format, the excel will validate the page's content's
format, and the Large ViewState may somehow cause the Application failed to
finish the convert operation. How do you think of ?



Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx
 

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,756
Messages
2,569,533
Members
45,007
Latest member
OrderFitnessKetoCapsules

Latest Threads

Top