ehappy
Npoi 合并相同单元格的内容

int Merage = 2;

for (int j = 2; j <= sheet.LastRowNum; j++)

{

if (j > 2 && sheet.GetRow(j).GetCell(0).StringCellValue != sheet.GetRow(j - 1).GetCell(0).StringCellValue)

{

sheet.AddMergedRegion(new CellRangeAddress(Merage, j - 1, 0, 0));

//sheet.GetRow(j).GetCell(1).SetCellValue(j);

Merage = j;

}

}

sheet.AddMergedRegion(new CellRangeAddress(Merage, sheet.LastRowNum, 0, 0));


粤ICP备18122249号