Convert DataGrid to Excel

Discussion in 'ASP .Net Web Controls' started by DOKOM, May 5, 2004.

  1. DOKOM

    DOKOM Guest

    Hi
    I wrote a small function, thaht converts a DataGrid to Excel from a Web-Application (C#)
    Running the function with 100-200 rows it just works fine
    Starting a "special" Report produces a DataDrid with about 13650 Rows. Now the conversion to Excel does not work
    Are there any known restrictions
    The code looks like this
    <----
    private void btnExcel_Click(object sender, System.EventArgs e

    Response.ContentType = "application/vnd.ms-excel"
    Response.Charset = ""
    this.EnableViewState = false
    System.IO.StringWriter tw = new System.IO.StringWriter(System.Globalization.CultureInfo.CurrentCulture)
    System.Web.UI.HtmlTextWriter hw = new System.Web.UI.HtmlTextWriter(tw)
    ReportGrid.RenderControl(hw)
    Response.Write(makeHTMLcode(tw.ToString()))
    Response.End()

    <---->
     
    DOKOM, May 5, 2004
    #1
    1. Advertising

  2. Maybe there's a control character or format command in the 201st row that is
    throwing Excel off?

    Excel should be able to accept 65,536 rows.


    "DOKOM" <> wrote in message
    news:...
    > Hi,
    > I wrote a small function, thaht converts a DataGrid to Excel from a
    > Web-Application (C#).
    > Running the function with 100-200 rows it just works fine.
    > Starting a "special" Report produces a DataDrid with about 13650 Rows. Now
    > the conversion to Excel does not work.
    > Are there any known restrictions?
    > The code looks like this:
    > <---->
    > private void btnExcel_Click(object sender, System.EventArgs e)
    > {
    > Response.ContentType = "application/vnd.ms-excel";
    > Response.Charset = "";
    > this.EnableViewState = false;
    > System.IO.StringWriter tw = new
    > System.IO.StringWriter(System.Globalization.CultureInfo.CurrentCulture);
    > System.Web.UI.HtmlTextWriter hw = new System.Web.UI.HtmlTextWriter(tw);
    > ReportGrid.RenderControl(hw);
    > Response.Write(makeHTMLcode(tw.ToString()));
    > Response.End();
    > }
    > <---->
     
    Ken Cox [Microsoft MVP], May 5, 2004
    #2
    1. Advertising

  3. DOKOM

    DOKOM Guest

    I think that the Request to render the Excel sheet is not send by the browser (IE6). After filling and showing the DataGrid the IEXPLORE-Process uses about 170 MB of Memory
    When I press the "Excel" Button in my Webpage nothing happens. Neither private void btnExcel_Click () is called nor page functions like OnInit(...) or InitilaizeComponents(...)

    Any more Ideas?
    Thanks in advance


    ----- Ken Cox [Microsoft MVP] wrote: ----

    Maybe there's a control character or format command in the 201st row that is
    throwing Excel off

    Excel should be able to accept 65,536 rows
     
    DOKOM, May 6, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?UGF0cmljayBTLg==?=

    Convert DataGrid to Excel

    =?Utf-8?B?UGF0cmljayBTLg==?=, May 5, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    3,270
    Rick Spiewak
    May 5, 2004
  2. =?Utf-8?B?SmltIEhlYXZleQ==?=

    Excel _WorkBook vs. Excel.Workbook

    =?Utf-8?B?SmltIEhlYXZleQ==?=, Sep 29, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    3,652
    Steve C. Orr [MVP, MCSD]
    Sep 29, 2004
  3. =?Utf-8?B?c2hhc2hhbmsga3Vsa2Fybmk=?=

    Problem with Excel reports ::::Excel 2003 Migration To Excel 2007

    =?Utf-8?B?c2hhc2hhbmsga3Vsa2Fybmk=?=, Oct 5, 2007, in forum: ASP .Net
    Replies:
    15
    Views:
    1,541
    =?Utf-8?B?c2hhc2hhbmsga3Vsa2Fybmk=?=
    Oct 24, 2007
  4. Sean

    Exceeds Excel Limits to convert datagrid

    Sean, Feb 20, 2004, in forum: ASP .Net Datagrid Control
    Replies:
    1
    Views:
    117
    Alvin Bruney [MVP]
    Mar 2, 2004
  5. Paul D. Fox

    Display a Datagrid & Export a Datagrid to Excel

    Paul D. Fox, Jul 21, 2005, in forum: ASP .Net Datagrid Control
    Replies:
    1
    Views:
    227
    Elton Wang
    Jul 21, 2005
Loading...

Share This Page