62,072
社区成员
发帖
与我相关
我的任务
分享
HSSFCellStyle style8 = workbook.CreateCellStyle();
style8.FillForegroundColor = NPOI.HSSF.Util.HSSFColor.WHITE.index;
style8.FillPattern = HSSFCellStyle.SQUARES;
style8.FillBackgroundColor = NPOI.HSSF.Util.HSSFColor.RED.index;
foreach (DataRow dr in dtSource.Rows)
{
hssfRow = sheet.CreateRow(i + 1);
if (i == 5)//11111111111
{
hssfRow.RowStyle = style8;
}
foreach (DataColumn dc in dtSource.Columns)
{
string dcname = dc.ColumnName;
string dcc = dc.ToString();
//object detecell = dr[dc];
string hssfcell = dr[dc].ToString();
HSSFCell cell = hssfRow.CreateCell(dc.Ordinal);
cell.SetCellValue(hssfcell);
}
if (i == 5)//222222222
{
hssfRow.RowStyle = style8;
}
i++;
}