FileStream fs = new FileStream(ExcelPath, FileMode.Open);
HSSFWorkbook workbook = new HSSFWorkbook(fs);
HSSFSheet currentSheet = (HSSFSheet)workbook.GetSheet("sheet");
HSSFCellStyle style8 = (HSSFCellStyle) workbook.CreateCellStyle();
style8.FillForegroundColor = NPOI.HSSF.Util.HSSFColor.WHITE.index;
style8.FillBackgroundColor = NPOI.HSSF.Util.HSSFColor.RED.index;
HSSFCell cell = new HSSFCell(workbook, currentSheet, 4, (short)(4));
cell.CellStyle = style8;
cell.SetCellValue("123");
fs.close();
阅读全部 | 2013年4月3日 13:58