Skip to content

Don't break when loading an Excel file containing a chartsheet #466

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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 16, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions lib/xlsx/xform/book/workbook-xform.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,9 +158,16 @@ utils.inherits(WorkbookXform, BaseXform, {
return;
}
worksheet = model.worksheetHash['xl/' + rel.Target];
worksheet.name = sheet.name;
worksheet.id = sheet.id;
worksheets[index++] = worksheet;
// If there are "chartsheets" in the file, rel.Target will
// come out as chartsheets/sheet1.xml or similar here, and
// that won't be in model.worksheetHash.
// As we don't have the infrastructure to support chartsheets,
// we will ignore them for now:
if (worksheet) {
worksheet.name = sheet.name;
worksheet.id = sheet.id;
worksheets[index++] = worksheet;
}
});

// reconcile print areas
Expand Down
Binary file added spec/integration/data/chart-sheet.xlsx
Binary file not shown.
8 changes: 8 additions & 0 deletions spec/integration/worksheet.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -630,4 +630,12 @@ describe('Worksheet', function() {
});
});
});

it('Should not break when importing an Excel file that contains a chartsheet', function() {
return new Excel.Workbook().xlsx.readFile(path.resolve(__dirname, 'data', 'chart-sheet.xlsx'))
.then(function(workbook) {
expect(workbook).to.have.property('worksheets');
expect(workbook.worksheets).to.have.length(1);
});
});
});
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy