有没有合并使用Apache POI库细胞在Excel中任何其他方式?
我试着用以下,但它不工作
//选择地区工作表合并数据 的CellRangeAddress区= CellRangeAddress.valueOf(A+ rowNo +:D + rowNo); //合并区域 sheet1.addMergedRegion(区);解决方案
您可以使用 sheet.addMergedRegion(rowFrom,rowTo,colFrom,colTo);
例如 sheet.addMergedRegion(新的CellRangeAddress(1,1,4,1)); 将从B2合并E2。请记住它是零的索引。
有关详细信息请参阅 BusyDeveloper指南
Is there any other way to merge cells in Excel using Apache POI library?
I was trying using the following, but its not working
// selecting the region in Worksheet for merging data CellRangeAddress region = CellRangeAddress.valueOf("A" + rowNo + ":D" + rowNo); // merging the region sheet1.addMergedRegion(region);解决方案
You can use sheet.addMergedRegion(rowFrom,rowTo,colFrom,colTo);
example sheet.addMergedRegion(new CellRangeAddress(1,1,4,1)); will merge from B2 to E2. Remember it is zero based indexing.
for detail refer BusyDeveloper's Guide