优化合并单元格读取

This commit is contained in:
Looly
2022-10-09 19:07:19 +08:00
parent 7c2ce9731e
commit da21e6b071
2 changed files with 2 additions and 4 deletions

View File

@@ -479,10 +479,7 @@ public class CellUtil {
* @since 5.4.5
*/
private static Cell getCellIfMergedRegion(Sheet sheet, int x, int y) {
final int sheetMergeCount = sheet.getNumMergedRegions();
CellRangeAddress ca;
for (int i = 0; i < sheetMergeCount; i++) {
ca = sheet.getMergedRegion(i);
for (final CellRangeAddress ca : sheet.getMergedRegions()) {
if (ca.isInRange(y, x)) {
return SheetUtil.getCell(sheet, ca.getFirstRow(), ca.getFirstColumn());
}