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);