Quantcast
Channel: CodeProject Latest postings for ASP.NET
Viewing all articles
Browse latest Browse all 3938

Format Excel Row Height

$
0
0
I am exporting a data table to Excel, but my row height get wildly large, how can this be changed to actually set the row height?
publicvoid ExportToExcel(DataTable dataTable)
{
		string filename = "Report.xls";
		StringWriter tw = new System.IO.StringWriter();
		HtmlTextWriter hw = new System.Web.UI.HtmlTextWriter(tw); 
		DataGrid dgGrid = new DataGrid();
		dgGrid.DataSource = dataTable;
		dgGrid.DataBind();
		dgGrid.RenderControl(hw);
		HttpContext.Current.Response.ContentType = "application/vnd.ms-excel";
		HttpContext.Current.Response.AppendHeader("Content-Disposition", "attachment; filename=" + filename + ""); 
		HttpContext.Current.Response.Write(tw.ToString());
		HttpContext.Current.Response.End();
}

Viewing all articles
Browse latest Browse all 3938


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>