在使用jxl api進行合併excel的單元格的時候,
已經合併過的單元格就不能再跟其他單元格合併了,否則就是會有警告的。
例如
Warning: Could not merge cells C9-D9 as they clash with an existing set of merged cells.
警告說明很清楚。
說不能合併C9-D9的單元格。因爲已經有單元格存在一系列被合併的單元格了。
像下面這樣寫是不行的。
writableSheet1.mergeCells(2, 8, 2, 9);
writableSheet1.mergeCells(2, 8, 3, 8);
要寫就這樣寫。
writableSheet1.mergeCells(2, 8, 3, 9);
一行代碼搞定。