Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Dec 28, 2012 07:41 AM by Decker Dong - MSFT
Member
62 Points
129 Posts
Dec 27, 2012 01:58 PM|LINK
I have a situation where my RadGrid has some rows Containing multiple rows
When I export this using RadGrid's export functionality, I see multiple cells used for 1 cell
All-Star
31523 Points
6437 Posts
Dec 27, 2012 02:22 PM|LINK
Dec 27, 2012 02:36 PM|LINK
<ExportSettings IgnorePaging="True" HideStructureColumns="true" ExportOnlyData="True"> </ExportSettings>
ShowExportToExcelButton="True"
I use these values with RadGrid and when I export to Excel, it generates a separate cell for each row (which I cant leave like that)
118619 Points
18779 Posts
Dec 28, 2012 12:29 AM|LINK
wallace740 wallace740
Hi,
Considering it that this belongs to a 3-rd party control tool of Telerik, I'm afraid Microsoft cannot do much comments on that.
http://www.telerik.com/community/forums/aspnet/grid.aspx
If you'd like to use GridView instead (because that's Microsoft control). I'd like to recommand you this:
http://geekswithblogs.net/AzamSharp/archive/2005/12/21/63843.aspx
Dec 28, 2012 07:24 AM|LINK
I use standart GridView to export to excel but the same thing happens.
HTML code is separated into multiple cells :(
protected void ExceleAktarLinkButton_Click(object sender, EventArgs e) { Response.Clear(); Response.AddHeader("content-disposition", "attachment;filename=testExport.xls"); Response.Charset = ""; Response.Cache.SetCacheability(HttpCacheability.NoCache); Response.ContentType = "application/vnd.xls"; System.IO.StringWriter stringWrite = new System.IO.StringWriter(); HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite); form1.Controls.Clear(); form1.Controls.Add(GridView1); form1.RenderControl(htmlWrite); Response.Write(stringWrite.ToString()); Response.End(); } //HTML Codes into Visual HTML protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { for (int j = 0; j < e.Row.Cells.Count; j++) { string encoded = e.Row.Cells[j].Text; e.Row.Cells[j].Text = Context.Server.HtmlDecode(encoded); } } }
Screenshot(below) when exported from standart GridView.
1 cell in my GridView is separated into multiple rows :(
Dec 28, 2012 07:41 AM|LINK
To be very honest, it's not an easy task to export a GridView with Html formation.
Maybe you can try to use this tool:
http://highoncoding.com/Articles/202_GridView_Export_to_Excel_Button_Control.aspx
wallace740
Member
62 Points
129 Posts
Exporting from RadGrid to Excel - multiple cell problem
Dec 27, 2012 01:58 PM|LINK
I have a situation where my RadGrid has some rows Containing multiple rows
When I export this using RadGrid's export functionality, I see multiple cells used for 1 cell
oned_gk
All-Star
31523 Points
6437 Posts
Re: Exporting from RadGrid to Excel - multiple cell problem
Dec 27, 2012 02:22 PM|LINK
wallace740
Member
62 Points
129 Posts
Re: Exporting from RadGrid to Excel - multiple cell problem
Dec 27, 2012 02:36 PM|LINK
<ExportSettings IgnorePaging="True" HideStructureColumns="true" ExportOnlyData="True">
</ExportSettings>
ShowExportToExcelButton="True"
I use these values with RadGrid and when I export to Excel, it generates a separate cell for each row (which I cant leave like that)
Decker Dong ...
All-Star
118619 Points
18779 Posts
Re: Exporting from RadGrid to Excel - multiple cell problem
Dec 28, 2012 12:29 AM|LINK
Hi,
Considering it that this belongs to a 3-rd party control tool of Telerik, I'm afraid Microsoft cannot do much comments on that.
http://www.telerik.com/community/forums/aspnet/grid.aspx
If you'd like to use GridView instead (because that's Microsoft control). I'd like to recommand you this:
http://geekswithblogs.net/AzamSharp/archive/2005/12/21/63843.aspx
wallace740
Member
62 Points
129 Posts
Re: Exporting from RadGrid to Excel - multiple cell problem
Dec 28, 2012 07:24 AM|LINK
I use standart GridView to export to excel but the same thing happens.
HTML code is separated into multiple cells :(
protected void ExceleAktarLinkButton_Click(object sender, EventArgs e) { Response.Clear(); Response.AddHeader("content-disposition", "attachment;filename=testExport.xls"); Response.Charset = ""; Response.Cache.SetCacheability(HttpCacheability.NoCache); Response.ContentType = "application/vnd.xls"; System.IO.StringWriter stringWrite = new System.IO.StringWriter(); HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite); form1.Controls.Clear(); form1.Controls.Add(GridView1); form1.RenderControl(htmlWrite); Response.Write(stringWrite.ToString()); Response.End(); } //HTML Codes into Visual HTML protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { for (int j = 0; j < e.Row.Cells.Count; j++) { string encoded = e.Row.Cells[j].Text; e.Row.Cells[j].Text = Context.Server.HtmlDecode(encoded); } } }Screenshot(below) when exported from standart GridView.
1 cell in my GridView is separated into multiple rows :(

Decker Dong ...
All-Star
118619 Points
18779 Posts
Re: Exporting from RadGrid to Excel - multiple cell problem
Dec 28, 2012 07:41 AM|LINK
Hi,
To be very honest, it's not an easy task to export a GridView with Html formation.
Maybe you can try to use this tool:
http://highoncoding.com/Articles/202_GridView_Export_to_Excel_Button_Control.aspx