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
917 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 36

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

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

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

Suggested Solutions

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…
More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

739 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