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

Invalid character in name #83

Open
skerit opened this issue Feb 7, 2020 · 6 comments
Open

Invalid character in name #83

skerit opened this issue Feb 7, 2020 · 6 comments

Comments

@skerit
Copy link

skerit commented Feb 7, 2020

When saving the workbook I keep getting this error.

Error: Invalid character in name
    at XMLStringifier.assertLegalName (node_modules/msexcel-builder/node_modules/xmlbuilder/lib/XMLStringifier.js:235:17)
    at XMLStringifier.name (node_modules/msexcel-builder/node_modules/xmlbuilder/lib/XMLStringifier.js:45:21)
    at new XMLElement (node_modules/msexcel-builder/node_modules/xmlbuilder/lib/XMLElement.js:30:36)
    at XMLElement.node (node_modules/msexcel-builder/node_modules/xmlbuilder/lib/XMLNode.js:292:17)
    at XMLElement.element (node_modules/msexcel-builder/node_modules/xmlbuilder/lib/XMLNode.js:187:30)
    at XMLElement.ele (node_modules/msexcel-builder/node_modules/xmlbuilder/lib/XMLNode.js:611:21)
    at XlWorkbook.toxml (node_modules/msexcel-builder/lib/msexcel-builder.js:191:8)
    at Workbook.save (node_modules/msexcel-builder/lib/msexcel-builder.js:809:70)
    at Workbook.save (node_modules/msexcel-builder/lib/msexcel-builder.js:7:59)
    at Editor._export (controller/chimera_editor_controller.js:168:11)"

Because you use the name fileVersion (with a space at the end)

@ratnabh
Copy link

ratnabh commented Feb 18, 2020

` var workbook = excelbuilder.createWorkbook("./", "sample.xlsx");

var sheet1 = workbook.createSheet("sheet1", 12, 10);

sheet1.set(1, 1, "I am title");

for (var i = 2; i < 5; i++)
sheet1.set(i, 1, "test" + i);

workbook.save(function(ok) {
if (!ok) workbook.cancel();
else console.log("congratulations, your workbook created");}`

I am also getting the same error, idk why ..

@InnProgress
Copy link

Looks like xmlbuilder was updated and made it impossible to use it with msexcel-builder due to using whitespaces in several names that are being passed to xmlbuilder.
One is "fileVersion " and another is "workbookView ", you can just open msexcel-builder.js file and remove those whitespaces from these strings and everything should work.
Also there is a pull request with fix to this error but looks like owner of repository doesn't care.

@dordetto
Copy link

dordetto commented Jan 6, 2021

unfortunately the error continues. January 2021

@InnProgress
Copy link

@dordetto yeah, author of library does not accept pull requests, but you can get working version of library here https://github.com/InnProgress/msexcel-builder or just check already mentioned pull requests.

@dordetto
Copy link

dordetto commented Jan 6, 2021

@InnProgress thanks!!!
After the error and your message I changed to EXCELJS and worked perfectly

@abhishekkaria
Copy link

change your node version to 8.x i am facing same error on 10.13.0 but not facing in 8.11.1

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

5 participants