Hi I am exporting database to excel with below method as
Response.ClearContent();
Response.Buffer = true;
Response.AddHeader("content-disposition", "attachment; filename=" + FileName);
Response.ContentType = "application/vnd.ms-excel";
EnableViewState = false;
Response.Write("<style> TABLE { border:dotted 1px #999; } TH { border:dotted 1px #D5D5D5; text-align:center } TD { border:dotted 1px #D5D5D5; } </style>");
Response.Write("<table>");
Response.Write("<tr>");
Response.Write("<th>Actual Estimated Price</th>");
Response.Write("<th>Aprroved Estimated Price </th>");
Response.Write("<th>Actual Price</th>");
Response.Write("<th>Aprroved Actual Price </th>");
Response.Write("<th>TransactionID </th>");
Response.Write("<th>Created On</th>");
Response.Write("</tr>");
foreach (DataRow dr in dt.Rows)
{
Response.Write("<tr>");
Response.Write("<td>");
Response.Write(String.Format("{0:0.0#}", dr["EstimatedPriceTotal"].ToString()));
Response.Write("</td>");
Response.Write("<td>");
Response.Write(String.Format("{0:0.0#}", dr["ApprovedEstimatedPriceTotal"].ToString()));
Response.Write("</td>");
Response.Write("<td>");
Response.Write(String.Format("{0:0.0#}", dr["ActualPriceTotal"].ToString()));
Response.Write("</td>");
Response.Write("<td>");
Response.Write(String.Format("{0:0.0#}", dr["ApprovedActualPriceTotal"].ToString()));
Response.Write("</td>");
Response.Write("<td>");
Response.Write(dr["TransactionID"].ToString());
Response.Write("</td>");
Response.Write("<td>");
Response.Write(Convert.ToDateTime(dr["CreatedOn"].ToString()));
Response.Write("</td>");
Response.Write("</tr>");
}
Response.Write("</table>");
Response.End();
but I am not able to export Actual Estimated Price, Aprroved Estimated Price in excel as decimal format
The value is coming as 5 instead of showing 5.00
How can I format some column of excel to decimal format from c# side
Update
How can I merge column header merge in EPPPlus
I want both header name as
CustomerName
Mitesh Jain