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
882 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 your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

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…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

746 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

13 Experts available now in Live!

Get 1:1 Help Now