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

Already on GitHub? Sign in to your account

MS Excel has problems with sheet name with leading underscore and length > 22 #992

Closed
samusstrike opened this issue Feb 14, 2018 · 0 comments

Comments

@samusstrike
Copy link

The title says it all. Here is code to reproduce the issue. The comments describe the fail/pass cases.
Node v8.9.4
xlsx: 0.12.0

//Fail: If an underscore is used as the beginning character in the sheet name and the name length > 22, then it fails.
//Pass1: If an underscore is used as the beginning character in the sheet name and the length <= 22, then it passes.
//Pass2: If an no underscore is used as the beginning character in the sheet name and the length > 22, then it passes.
//NOTE: Sheet name limit is 31 which is not in question for this issue.
//Failure means that when opening the file in MS Excel (2016), it states: "We found a problem with some content in 'fail.xlsx'. Do you want us to try to recover..."
//Repair message: Repaired Records: Worksheet properties from /xl/worksheets/sheet1.xml part
const xlsx = require("xlsx");
var sheetName_Fail = "_UnderscoreStart_moreThan22Char";
var sheetName_Pass1 = "_UndStart_less23Chars";
var sheetName_Pass2 = "noUnderscoreStart_moreTh22Char";
testCreateWorkbook(sheetName_Fail,"fail.xlsx");
testCreateWorkbook(sheetName_Pass1,"pass1.xlsx");
testCreateWorkbook(sheetName_Pass2,"pass2.xlsx");

function testCreateWorkbook(sheetName,fileName) {
    const wb = xlsx.utils.book_new();
    const data = [[]];
    const sheet = xlsx.utils.aoa_to_sheet(data);
    xlsx.utils.book_append_sheet(wb, sheet, sheetName);
    xlsx.writeFile(wb, __dirname + "/" + fileName);
}
saarCiklum pushed a commit to Folcon/js-xlsx that referenced this issue Aug 20, 2020
- BIFF5 write number formats and other features
- XLSX/XLSB/BIFF8 Suppress "Number stored as Text" errors
- codename awareness (fixes SheetJS#992 h/t @samusstrike)
- updated CFB to 1.0.3
- demo refresh
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