From 71e191408da6b2795145b7cdf7e04da17d85d91f Mon Sep 17 00:00:00 2001 From: liqionghai <1> Date: Fri, 22 Aug 2025 11:08:12 +0800 Subject: [PATCH] 1 --- YSZKDZGongNeng_MX/LiteVersionPlugIn2.cs | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/YSZKDZGongNeng_MX/LiteVersionPlugIn2.cs b/YSZKDZGongNeng_MX/LiteVersionPlugIn2.cs index 129f005..bb1feb9 100644 --- a/YSZKDZGongNeng_MX/LiteVersionPlugIn2.cs +++ b/YSZKDZGongNeng_MX/LiteVersionPlugIn2.cs @@ -111,6 +111,8 @@ namespace Pilot.Report.Exploitation.AccountsReceivable // 设置垂直居中对齐 cellStyle.VerticalAlignment = VerticalAlignment.Center; + cellStyle.DataFormat = workbook.CreateDataFormat().GetFormat("0.00"); + // 创建一个单元格样式--------------------------------- ICellStyle cellStyle2 = workbook.CreateCellStyle(); @@ -262,7 +264,7 @@ namespace Pilot.Report.Exploitation.AccountsReceivable if(!string.IsNullOrWhiteSpace(list[i]["FQty"].ToString())) { int FQty = Convert.ToInt32(list[i]["FQty"]); - c6.SetCellValue("" + FQty + ""); c6.CellStyle = cellStyle; //数量 + c6.SetCellValue(Convert.ToDouble(FQty)); c6.CellStyle = cellStyle; //数量 } ICell c7 = rowi.CreateCell(6); c7.SetCellValue(""); c7.CellStyle = cellStyle; @@ -276,14 +278,14 @@ namespace Pilot.Report.Exploitation.AccountsReceivable if(!string.IsNullOrWhiteSpace(list[i]["FAllAmount"].ToString())) { decimal FAllAmount = Math.Round(Convert.ToDecimal(list[i]["FAllAmount"]), 2); - c8.SetCellValue("" + FAllAmount + ""); c8.CellStyle = cellStyle; + c8.SetCellValue(Convert.ToDouble(FAllAmount)); c8.CellStyle = cellStyle; } ICell c9 = rowi.CreateCell(8); c9.SetCellValue(""); c9.CellStyle = cellStyle; if (!string.IsNullOrWhiteSpace(list[i]["OrderAmount"].ToString())) { decimal OrderAmount = Math.Round(Convert.ToDecimal(list[i]["OrderAmount"]), 2); - c9.SetCellValue("" + OrderAmount + ""); c9.CellStyle = cellStyle; + c9.SetCellValue(Convert.ToDouble(OrderAmount)); c9.CellStyle = cellStyle; } @@ -291,28 +293,28 @@ namespace Pilot.Report.Exploitation.AccountsReceivable if (!string.IsNullOrWhiteSpace(list[i]["ShipmentsNum"].ToString())) { int ShipmentsNum = Convert.ToInt32(list[i]["ShipmentsNum"]); - c11.SetCellValue("" + ShipmentsNum + ""); c11.CellStyle = cellStyle; + c11.SetCellValue(Convert.ToDouble(ShipmentsNum)); c11.CellStyle = cellStyle; } ICell c12 = rowi.CreateCell(11); c12.SetCellValue(""); c12.CellStyle = cellStyle; if (!string.IsNullOrWhiteSpace(list[i]["ShipmentsAmount"].ToString())) { decimal ShipmentsAmount = Math.Round(Convert.ToDecimal(list[i]["ShipmentsAmount"]), 2); - c12.SetCellValue("" + ShipmentsAmount + ""); c12.CellStyle = cellStyle; + c12.SetCellValue(Convert.ToDouble(ShipmentsAmount)); c12.CellStyle = cellStyle; } ICell c14 = rowi.CreateCell(13); c14.SetCellValue(""); c14.CellStyle = cellStyle; if (!string.IsNullOrWhiteSpace(list[i]["ReturnNum"].ToString())) { int ReturnNum = Convert.ToInt32(list[i]["ReturnNum"]); - c14.SetCellValue("" + ReturnNum + ""); c14.CellStyle = cellStyle; + c14.SetCellValue(Convert.ToDouble(ReturnNum)); c14.CellStyle = cellStyle; } ICell c15 = rowi.CreateCell(14); c15.SetCellValue(""); c15.CellStyle = cellStyle; if (!string.IsNullOrWhiteSpace(list[i]["ReturnAmount"].ToString())) { decimal ReturnAmount = Math.Round(Convert.ToDecimal(list[i]["ReturnAmount"]), 2); - c15.SetCellValue("" + ReturnAmount + ""); c15.CellStyle = cellStyle; + c15.SetCellValue(Convert.ToDouble(ReturnAmount)); c15.CellStyle = cellStyle; } ICell c19 = rowi.CreateCell(18); c19.SetCellValue(""); c19.CellStyle = cellStyle; @@ -320,21 +322,21 @@ namespace Pilot.Report.Exploitation.AccountsReceivable { decimal PaymentAmount = Math.Round(Convert.ToDecimal(list[i]["PaymentAmount"]), 2); - c19.SetCellValue("" + PaymentAmount + ""); c19.CellStyle = cellStyle; + c19.SetCellValue(Convert.ToDouble(PaymentAmount)); c19.CellStyle = cellStyle; } ICell c20 = rowi.CreateCell(19); c20.SetCellValue(""); c20.CellStyle = cellStyle; if (!string.IsNullOrWhiteSpace(list[i]["ShippedDebt"].ToString())) { decimal ShippedDebt = Math.Round(Convert.ToDecimal(list[i]["ShippedDebt"]), 2); - c20.SetCellValue("" + ShippedDebt + ""); c20.CellStyle = cellStyle; + c20.SetCellValue(Convert.ToDouble(ShippedDebt)); c20.CellStyle = cellStyle; } ICell c21 = rowi.CreateCell(20); c21.SetCellValue(""); c21.CellStyle = cellStyle; if (!string.IsNullOrWhiteSpace(list[i]["InvoicedDebt"].ToString())) { decimal InvoicedDebt = Math.Round(Convert.ToDecimal(list[i]["InvoicedDebt"]), 2); - c21.SetCellValue("" + InvoicedDebt + ""); c21.CellStyle = cellStyle; + c21.SetCellValue(Convert.ToDouble(InvoicedDebt)); c21.CellStyle = cellStyle; } ICell c17 = rowi.CreateCell(16); c17.SetCellValue(""); c17.CellStyle = cellStyle; @@ -342,7 +344,7 @@ namespace Pilot.Report.Exploitation.AccountsReceivable { decimal BillingAmount = Math.Round(Convert.ToDecimal(list[i]["BillingAmount"]), 2); - c17.SetCellValue("" + BillingAmount + ""); c17.CellStyle = cellStyle; + c17.SetCellValue(Convert.ToDouble(BillingAmount )); c17.CellStyle = cellStyle; } ICell c10 = rowi.CreateCell(9); c10.SetCellValue(ShipmentsDate); c10.CellStyle = cellStyle2;//发货日期