主標題列底色改為淺灰

master
dk96 2025-01-03 15:23:29 +08:00
parent 380ec1e8f5
commit e5e3ec4f38
1 changed files with 24 additions and 0 deletions

View File

@ -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 + rowCount, 0, 0));
sheet.AddMergedRegion(new NPOI.SS.Util.CellRangeAddress(editIndex, editIndex, 1, 6)); sheet.AddMergedRegion(new NPOI.SS.Util.CellRangeAddress(editIndex, editIndex, 1, 6));
row = (XSSFRow)sheet.GetRow(editIndex); 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[0].SetCellValue(itemNumber);
row.Cells[1].SetCellValue(objMain.quotationMainItem_name); row.Cells[1].SetCellValue(objMain.quotationMainItem_name);