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
906 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

How Do You Stack Up Against Your Peers?

With today’s modern enterprise so dependent on digital infrastructures, the impact of major incidents has increased dramatically. Grab the report now to gain insight into how your organization ranks against your peers and learn best-in-class strategies to resolve incidents.

Question has a verified solution.

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

Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

789 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