Skip to content

Conversation

ytjmt
Copy link
Contributor

@ytjmt ytjmt commented May 29, 2023

Summary

Closes #1341

Test plan

I confirmed the type is Range['range'][]:

  • // Merges
    model.merges = [];
    _.each(this._merges, merge => {
    model.merges.push(merge.range);
    });
  • _mergeCellsInternal(dimensions, ignoreStyle) {
    // check cells aren't already merged
    _.each(this._merges, merge => {
    if (merge.intersects(dimensions)) {
    throw new Error('Cannot merge already merged cells');
    }
    });
    // apply merge
    const master = this.getCell(dimensions.top, dimensions.left);
    for (let i = dimensions.top; i <= dimensions.bottom; i++) {
    for (let j = dimensions.left; j <= dimensions.right; j++) {
    // merge all but the master cell
    if (i > dimensions.top || j > dimensions.left) {
    this.getCell(i, j).merge(master, ignoreStyle);
    }
    }
    }
    // index merge
    this._merges[master.address] = dimensions;
  • const dimensions = new Range(cells);
    this._mergeCellsInternal(dimensions, true);

Copy link
Member

@Siemienik Siemienik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] Typescript types not support worksheet.model.merges
2 participants