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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
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…

772 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