Fixed vbaraw parsing

- fixes #594 h/t @fossamagna
- fixes #348 h/t @aleramesh
This commit is contained in:
MURAKAMI Masahiko 2017-03-14 21:00:33 +09:00 committed by SheetJS
parent 88eb98587c
commit 05185e13f2
4 changed files with 5 additions and 5 deletions

@ -135,7 +135,7 @@ function parse_zip(zip/*:ZIP*/, opts/*:?ParseOpts*/)/*:Workbook*/ {
out.files = zip.files;
}
if(opts.bookVBA) {
if(dir.vba.length > 0) out.vbaraw = getzipdata(zip,dir.vba[0],true);
if(dir.vba.length > 0) out.vbaraw = getzipdata(zip,dir.vba[0].replace(/^\//,''),true);
else if(dir.defaults && dir.defaults.bin === 'application/vnd.ms-office.vbaProject') out.vbaraw = getzipdata(zip,'xl/vbaProject.bin',true);
}
return out;

@ -434,9 +434,9 @@ describe('parse options', function() {
});
it('bookVBA should generate vbaraw (XLSX/XLSB)', function() {
var wb = X.readFile(paths.nfxlsx,{bookVBA:true});
assert(typeof wb.vbaraw !== 'undefined');
assert(wb.vbaraw);
wb = X.readFile(paths.nfxlsb,{bookVBA:true});
assert(typeof wb.vbaraw !== 'undefined');
assert(wb.vbaraw);
});
});
});

@ -13280,7 +13280,7 @@ function parse_zip(zip/*:ZIP*/, opts/*:?ParseOpts*/)/*:Workbook*/ {
out.files = zip.files;
}
if(opts.bookVBA) {
if(dir.vba.length > 0) out.vbaraw = getzipdata(zip,dir.vba[0],true);
if(dir.vba.length > 0) out.vbaraw = getzipdata(zip,dir.vba[0].replace(/^\//,''),true);
else if(dir.defaults && dir.defaults.bin === 'application/vnd.ms-office.vbaProject') out.vbaraw = getzipdata(zip,'xl/vbaProject.bin',true);
}
return out;

@ -13223,7 +13223,7 @@ function parse_zip(zip, opts) {
out.files = zip.files;
}
if(opts.bookVBA) {
if(dir.vba.length > 0) out.vbaraw = getzipdata(zip,dir.vba[0],true);
if(dir.vba.length > 0) out.vbaraw = getzipdata(zip,dir.vba[0].replace(/^\//,''),true);
else if(dir.defaults && dir.defaults.bin === 'application/vnd.ms-office.vbaProject') out.vbaraw = getzipdata(zip,'xl/vbaProject.bin',true);
}
return out;