justTryingToCode
Programmer
Hi all experts:
I am trying to capture nulls and keep them as nulls from a dataset to a datagrid to a xls export using httpResponse. The returned .xls file has blanks where the nulls should be.
Any help would be greatly appreciated. Here is the current code snippet:
string in_params = start + "|" + end;
reports rp = new reports(connString);
rp.get_report_details_for_render(5);
DataSet ds = new DataSet();
ds = update_property_page_specific_data(rp.get_report_dataSet_results(in_params));
DataGrid dg = new DataGrid();
dg.DataSource = ds.Tables[0];
dg.DataBind();
string strExportFile = "extract_" + DateTime.Now.ToString("MM_dd_yyyy_hh_mm_ss") + ".xls";
Response.Clear();
Response.AddHeader("content-disposition", "attachment;filename=" + strExportFile);
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);
dg.RenderControl(htmlWrite);
Response.Write(stringWrite.ToString());
Response.End();
Thanks in advance,
Jon
I am trying to capture nulls and keep them as nulls from a dataset to a datagrid to a xls export using httpResponse. The returned .xls file has blanks where the nulls should be.
Any help would be greatly appreciated. Here is the current code snippet:
string in_params = start + "|" + end;
reports rp = new reports(connString);
rp.get_report_details_for_render(5);
DataSet ds = new DataSet();
ds = update_property_page_specific_data(rp.get_report_dataSet_results(in_params));
DataGrid dg = new DataGrid();
dg.DataSource = ds.Tables[0];
dg.DataBind();
string strExportFile = "extract_" + DateTime.Now.ToString("MM_dd_yyyy_hh_mm_ss") + ".xls";
Response.Clear();
Response.AddHeader("content-disposition", "attachment;filename=" + strExportFile);
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);
dg.RenderControl(htmlWrite);
Response.Write(stringWrite.ToString());
Response.End();
Thanks in advance,
Jon