Skip to content

Commit

Permalink
inlineStr cell type support #1575 (#1576)
Browse files Browse the repository at this point in the history
* inlineStr cell type support #1575

* Added integration test for #1575

Co-authored-by: Siemienik Pawel <siemienik.pawel@gmail.com>
Co-authored-by: Andreas Lubbe <git@lubbe.org>
  • Loading branch information
3 people authored Sep 7, 2021
1 parent f150952 commit 33d833f
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/stream/xlsx/worksheet-reader.js
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,12 @@ class WorksheetReader extends EventEmitter {
current = c.v = {text: ''};
}
break;
case 'is':
case 't':
if (c) {
current = c.v = {text: ''};
}
break;
case 'mergeCell':
break;
default:
Expand Down Expand Up @@ -307,6 +313,7 @@ class WorksheetReader extends EventEmitter {
break;
}

case 'inlineStr':
case 'str':
cell.value = utils.xmlDecode(c.v.text);
break;
Expand Down
Binary file added spec/integration/data/test-issue-1575.xlsx
Binary file not shown.
23 changes: 23 additions & 0 deletions spec/integration/pr/test-pr-1576.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
const ExcelJS = verquire('exceljs');

describe('github issues', () => {
describe('pull request 1576 - inlineStr cell type support', () => {
it('Reading test-issue-1575.xlsx', () => {
const wb = new ExcelJS.Workbook();
return wb.xlsx
.readFile('./spec/integration/data/test-issue-1575.xlsx')
.then(() => {
const ws = wb.getWorksheet('Sheet1');
expect(ws.getCell('A1').value).to.equal('A');
expect(ws.getCell('B1').value).to.equal('B');
expect(ws.getCell('C1').value).to.equal('C');
expect(ws.getCell('A2').value).to.equal('1.0');
expect(ws.getCell('B2').value).to.equal('2.0');
expect(ws.getCell('C2').value).to.equal('3.0');
expect(ws.getCell('A3').value).to.equal('4.0');
expect(ws.getCell('B3').value).to.equal('5.0');
expect(ws.getCell('C3').value).to.equal('6.0');
});
});
});
});

0 comments on commit 33d833f

Please sign in to comment.