嗨,我正在使用以下方法將數(shù)據(jù)庫導(dǎo)出到excel 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>");但我無法以excel格式導(dǎo)出excel中的實際估計價格,批準(zhǔn)的估計價格該值顯示為5,而不是顯示5.00如何從C#端將Excel的某些列格式化為十進制格式
從Excel導(dǎo)出Excel列格式為十進制
慕工程0101907
2019-12-06 15:37:51