如何将单元格与Apache POI合并而不形成矩形合并区域?

时间:2022-04-04 20:21:51

If a given Excel file contains cells like the following for example:

如果给定的Excel文件包含如下单元格:

如何将单元格与Apache POI合并而不形成矩形合并区域?

If trying to use sheet.addMergedRegion for the the cells that contain the value "foo" the outcome is

如果尝试使用床单。对于包含值“foo”的单元格,结果是

如何将单元格与Apache POI合并而不形成矩形合并区域?

so the cells that contain the "bar" are actually added to the merged region.

因此包含“bar”的单元格实际上被添加到合并的区域中。

How can this behavior be avoided so that the merged region ONLY contains the "foo" cells?

如何避免这种行为,以便合并的区域只包含“foo”单元格?

1 个解决方案

#1


4  

This is not a limitation of Apache POI. This is a limitation of Excel. This cannot be done in Excel, and Apache POI matches Excel. Therefore this cannot be done. What you are seeing is the expected behavior.

这不是Apache POI的限制。这是Excel的一个局限性。这不能在Excel中完成,Apache POI与Excel匹配。因此,这是不可能的。你看到的是预期的行为。

#1


4  

This is not a limitation of Apache POI. This is a limitation of Excel. This cannot be done in Excel, and Apache POI matches Excel. Therefore this cannot be done. What you are seeing is the expected behavior.

这不是Apache POI的限制。这是Excel的一个局限性。这不能在Excel中完成,Apache POI与Excel匹配。因此,这是不可能的。你看到的是预期的行为。