export to excel

Discussion in 'ASP .Net' started by =?Utf-8?B?RWxhbmdv?=, Sep 29, 2006.

  1. I'm exporting a datagrid to an excel file.
    I'm using the following source code to export.
    DataTable dt = new DataTable();

    DataAccess.StoredProcedure sproc = new
    DataAccess.StoredProcedure("sproc_getdata");


    sproc.Run(dt);


    DataGrid1.DataSource = dt;


    DataGrid1.DataBind();


    DataGrid1.EnableViewState = false;


    DataGrid1.Visible = true;


    DataGrid1.GridLines = GridLines.Both;


    Response.Clear();


    Response.Buffer = true;


    Response.AddHeader( "Content-Disposition", "filename=File1.xls");


    StringWriter stringWriter = new StringWriter();


    HtmlTextWriter htmlWriter = new HtmlTextWriter(stringWriter);


    DataGrid1.RenderControl(htmlWriter);


    Response.Write(stringWriter.ToString());


    Response.ContentType="application/vnd.ms-excel";


    Response.End();


    Its working fine.


    but there is an isuue datagrid dt contains extended language
    strings (like chinese, japanese).These strings are not getting
    exported to excel .
    DataGrid is getting data from SQLServer2005 database. I know that
    sqlserver is using utf-16 encoding for unicode character. So i've tried
    to change Response.ContentEncoding to utf-16. But it is also not
    working.


    Can anyone help me.
     
    =?Utf-8?B?RWxhbmdv?=, Sep 29, 2006
    #1
    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?RGF2aWQgVmFsbGU=?=

    Invalid export DLL or export format

    =?Utf-8?B?RGF2aWQgVmFsbGU=?=, Oct 29, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    3,626
    =?Utf-8?B?RGF2aWQgVmFsbGU=?=
    Oct 29, 2003
  2. =?Utf-8?B?U3JpZGhhcg==?=

    using Microsoft Excel image for Export to Excel button

    =?Utf-8?B?U3JpZGhhcg==?=, Dec 9, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    3,116
    =?Utf-8?B?U3JpZGhhcg==?=
    Dec 9, 2005
  3. =?Utf-8?B?SGVtYW50IFNpcGFoaW1hbGFuaQ==?=

    Export to Excel (Default File Type - Excel)

    =?Utf-8?B?SGVtYW50IFNpcGFoaW1hbGFuaQ==?=, Apr 24, 2006, in forum: ASP .Net
    Replies:
    15
    Views:
    17,538
    syed hassan
    May 21, 2009
  4. Grey
    Replies:
    4
    Views:
    1,999
    Mark Rae [MVP]
    Oct 17, 2007
  5. Maarten Porters
    Replies:
    1
    Views:
    432
    Florian Gilcher
    Jul 28, 2008
Loading...

Share This Page