Mani Pazhana
asked on
Export to excel from Console app
Hello Experts,
I need to export string data to excel using console app (C#) without using any third party libraries...
i am getting object reference error...HttpContext.Curren t.Response .ClearCont ent();
here is my code so far...( i have it on class library project)
using System.Web;
private void ExportToExcel(string strData)
{
try
{
HttpContext.Current.Respon se.ClearCo ntent();
HttpContext.Current.Respon se.AddHead er("conten t-disposit ion", "attachment; filename=BatchResponse.xls ");
HttpContext.Current.Respon se.Content Type = "application/excel";
HttpContext.Current.Respon se.Write(s trData);
HttpContext.Current.Respon se.End();
}
catch (Exception ex)
{
log.LogExceptionError("Bat ch Settlement Process - ExportToExcel", ex);
}
finally
{
log = null;
}
}
Any help?
Thanks
I need to export string data to excel using console app (C#) without using any third party libraries...
i am getting object reference error...HttpContext.Curren
here is my code so far...( i have it on class library project)
using System.Web;
private void ExportToExcel(string strData)
{
try
{
HttpContext.Current.Respon
HttpContext.Current.Respon
HttpContext.Current.Respon
HttpContext.Current.Respon
HttpContext.Current.Respon
}
catch (Exception ex)
{
log.LogExceptionError("Bat
}
finally
{
log = null;
}
}
Any help?
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER