<asp:LinkButton ID="linkProcess" runat="server" OnClick="linkProcess_Click"><b>Export to Excel</b></asp:LinkButton>
/// <summary>
/// method to export report into excel
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void linkProcess_Click(object sender, EventArgs e)
{
/// <summary>
/// method to export report into excel
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void linkProcess_Click(object sender, EventArgs e)
{
Byte[] returnValue;
returnValue = rvManagementReports.ServerReport.Render("EXCEL");
Response.Buffer = true;
Response.Clear();
Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
Response.AddHeader("content-disposition", "attachment ; filename=filename." + "xls");
Response.BinaryWrite(returnValue);
Response.Flush();
Response.End();
}
for any language character use
/// <summary>
/// method to export report into excel
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void linkProcess_Click(object sender, EventArgs e)
{
Response.ClearContent();
Response.AddHeader("content-disposition", string.Format("attachment;filename={0}.xls", "YTDReviewsData"));
Response.ContentType = "application/ms-excel";
Response.ContentEncoding = System.Text.Encoding.Unicode;
Response.BinaryWrite(System.Text.Encoding.Unicode.GetPreamble());
System.IO.StringWriter stringWrite = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite);
gvDealDetails.RenderControl(htmlWrite);
Response.Write(stringWrite.ToString());
Response.End();
}
Response.Flush();
Response.End();
}
for any language character use
/// <summary>
/// method to export report into excel
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void linkProcess_Click(object sender, EventArgs e)
{
Response.ClearContent();
Response.AddHeader("content-disposition", string.Format("attachment;filename={0}.xls", "YTDReviewsData"));
Response.ContentType = "application/ms-excel";
Response.ContentEncoding = System.Text.Encoding.Unicode;
Response.BinaryWrite(System.Text.Encoding.Unicode.GetPreamble());
System.IO.StringWriter stringWrite = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite);
gvDealDetails.RenderControl(htmlWrite);
Response.Write(stringWrite.ToString());
Response.End();
}