Skip to content

[BUG] 4.4.8 InsertRows behaviour. & mergeCells & defaultRowHeight  #37

@zzx58-027

Description

@zzx58-027

🐛 Bug Report

Insert_rows did not update the corresponding cells style information in a timely manner, resulting in errors caused by deferred information in steps such as merge_cells.

  • mergeCells 方法似乎有 Bug, 总是会提示我存在 already merged cells, 但我很确认那里并没有.
  • 为什么会有这种问题, 另外我想知道有什么 debug 的办法, 能供我分析出现的情况, 报错提示有些简陋了.
  • 在我之前的测试中, 我通过 先 unmerge 再 merge 的方式 workaround.
  • 设置的默认行高 defaultRowHeight = 27.
    • 但是 insertRows 后的行的行高依旧是 15(似乎).
    • 没有内容的行的行高肉眼可见被正确设置. 原本就有内容的行高在去掉值后行高会恢复到设置的默认行高.
    • 需求应该可以手动设置 行高来实现, 但是能否让新插入的行也自动按 默认行高进行设置?
  • insertRows 的 i, n, o 等信息的描述不太友好, 不便理解具体含义, 另外经过测试, i, n, o 的行为不太理解, 有 unexpected 情况出现.

涉及内容如有需要的可联系我再提供.

这或许是原文档中目标位置存在 mergeCells 信息
我的插入行操作在 mergeCells 之前进行, 感觉这里有执行顺序错误的问题. insertRows 后, 行的样式并没有及时更新.

Lib version: 4.4.8

Steps To Reproduce

  const rows = Array(content_main_rows_count).fill([]);
  ws?.insertRows(start_row, rows, "n");
.....
      const set_merge_cells = () => {
        const start_cell = cell;
        if (col == 2) {
          const end_cell = ws.getRow(row)?.getCell(col + 1);
          // ws.unMergeCells(`${start_cell.address}:${end_cell.address}`);
          // ws.mergeCells(`${start_cell.address}:${end_cell.address}`);
          ws.unMergeCells(row, col, row, col + 1);
          ws.mergeCells(row, col, row, col + 1);
        }
        if ((row - start_row) % 6 == 0 && [1,4,5].includes(col)) {
        }
      };
      set_merge_cells();

The expected behaviour:

Possible solution (optional, but very helpful):

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions