Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] It Will Skip The First Cell[Axx] When Read Last Empty & Merged Line. #2731

Open
SeeMeJuiner opened this issue Mar 28, 2024 · 0 comments

Comments

@SeeMeJuiner
Copy link

SeeMeJuiner commented Mar 28, 2024

馃悰 Bug Report

Lib version: 4.4.0

Steps To Reproduce

sheet.eachRow(function (row, rowNumber) {
        if(rowNumber == 60) {
          debugger
        }
        records += '{';
        row.eachCell(function (cell, cellNumber) {
          if((cell.isMerged && cell._mergeCount > 0) || ( cell.master.address && cell.master._mergeCount > 0 )) {
            let mergeCell = {
              start: {col: undefined, row: undefined},
              end: {col: undefined, row: undefined},
            };

            // 
            if (cell.master.address && cell.master.address != cell.address) {
              // 
              mergeCell.start.col = mergeCells[cell.master.col + '-' + cell.master.row].start.col;    **<---It will occurs a error "Cannot read properties of undefined (reading 'start')"**  like image 3 as below
              mergeCell.start.row = mergeCells[cell.master.col + '-' + cell.master.row].start.row;
              mergeCell.end.col = mergeCells[cell.master.col + '-' + cell.master.row].end.col;
              mergeCell.end.row = mergeCells[cell.master.col + '-' + cell.master.row].end.row;
            } else {
              mergeCell.start.col = sheet._merges[cell.address].model.left - 1;
              mergeCell.start.row = sheet._merges[cell.address].model.top;
              mergeCell.end.col = sheet._merges[cell.address].model.right - 1;
              mergeCell.end.row = sheet._merges[cell.address].model.bottom;
            }
            mergeCells[cell.col + '-'+ cell.row] = mergeCell;
          }
          records += cell.col + ': ' + '"' + cell.value + '"';
          if(cell.col != row.cellCount) {
            records += ','
          }
        })
        records += '}';
        if(row.number != sheet.rowCount) {
          records += ',\n';
        }
      })

image 1
image

image2
image

image 3
image

The expected behaviour:

can read every cells when last row is emptly and merged.

Possible solution (optional, but very helpful):

@SeeMeJuiner SeeMeJuiner changed the title [BUG] It will skip the first cell[Axx] when Read Last Empty Line. [BUG] It Will Skip The First Cell[Axx] When Read Last Empty & Merged Line. Mar 28, 2024
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

No branches or pull requests

1 participant