From e5e3ec4f388fe31723eb52bec1ea582da662dffc Mon Sep 17 00:00:00 2001 From: dk96 Date: Fri, 3 Jan 2025 15:23:29 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=BB=E6=A8=99=E9=A1=8C=E5=88=97=E5=BA=95?= =?UTF-8?q?=E8=89=B2=E6=94=B9=E7=82=BA=E6=B7=BA=E7=81=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Controllers/ApiController.cs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/Controllers/ApiController.cs b/Controllers/ApiController.cs index 419b8390..26814151 100644 --- a/Controllers/ApiController.cs +++ b/Controllers/ApiController.cs @@ -361,7 +361,31 @@ namespace QuotationMaker.Controllers //sheet.AddMergedRegion(new NPOI.SS.Util.CellRangeAddress(editIndex, editIndex + rowCount, 0, 0)); sheet.AddMergedRegion(new NPOI.SS.Util.CellRangeAddress(editIndex, editIndex, 1, 6)); + + + row = (XSSFRow)sheet.GetRow(editIndex); + + //主項目儲存格背景色設定 + byte r = (byte)220; + byte g = (byte)220; + byte b = (byte)220; + + ICellStyle greyStyle1 = row.Cells[0].CellStyle; + greyStyle1.FillForegroundColor = IndexedColors.Grey25Percent.Index; + greyStyle1.FillForegroundColor = 0; + ((XSSFColor)greyStyle1.FillForegroundColorColor).SetRgb(new byte[] { r, g, b }); + greyStyle1.FillPattern = FillPattern.SolidForeground; + + ICellStyle greyStyle2 = row.Cells[1].CellStyle; + greyStyle2.FillForegroundColor = IndexedColors.Grey25Percent.Index; + greyStyle2.FillForegroundColor = 0; + ((XSSFColor)greyStyle2.FillForegroundColorColor).SetRgb(new byte[] { r, g, b }); + greyStyle2.FillPattern = FillPattern.SolidForeground; + + row.Cells[0].CellStyle = greyStyle1; + row.Cells[1].CellStyle = greyStyle2; + row.Cells[0].SetCellValue(itemNumber); row.Cells[1].SetCellValue(objMain.quotationMainItem_name);