Solved

In exporting GridView records to Excel 2003 using VS2010 with C#, how do I resolve error: Problems During Load, Problems came up in the following areas during load, Cell data too large?

Posted on 2013-12-07
2
894 Views
Last Modified: 2013-12-08
I am developing my first ASP.NET C# application using VS2010.

In trying to export a GridView to an Excel 2003 file, I get the following error message after I click on a command button to export the GridView control to Excel 2003:

Problems During Load:
Problems come up in the following areas during load

Cell data too large
-------------------------------------------------------------------------------------------------

The code from the click event of my command button to export is as follows:

protected void Button1_Click1(object sender, EventArgs e)
        {
            Response.ClearContent();
            Response.AppendHeader("contenet-disposition", "attachment; filename=Employee.xls");
            Response.ContentType = "application/vnd.ms-excel";

            StringWriter stringWriter = new StringWriter();
            HtmlTextWriter htmlTextWriter = new HtmlTextWriter(stringWriter);
            GridView1.RenderControl(htmlTextWriter);
            Response.Write(stringWriter.ToString());
            Response.End();
        }

        public override void VerifyRenderingInServerForm(Control control)
        {

        }
0
Comment
Question by:zimmer9
2 Comments
 
LVL 35

Accepted Solution

by:
Miguel Oz earned 500 total points
ID: 39704163
This error happens when you have a gridview cell with contents > 32,767 characters as per specs below:
http://office.microsoft.com/en-au/excel-help/excel-specifications-and-limits-HP005199291.aspx

Excel 2003 limit is 32,767 characters, your program can only load up to this limit, otherwise it will not work.
Your only choice is to limit the cell contents to 32,767 characters when loading data to gridview.
0
 

Author Comment

by:zimmer9
ID: 39705244
I'm trying to export 5 fields from a SQL Server table to Excel 2003.
The record layout is as follows and is comprised of 5,300 rows:

Do you see a problem with the following details:

Field Name             Data Type/(size)
--------------             --------------
trans date              datetime

process date          datetime

Bank                       nvarchar(255)

type                       nvarchar(255)

office                     nvarchar(255)
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

932 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now