forked from sheetjs/sheetjs
VBA CFB test [ci skip]
This commit is contained in:
parent
75845a0ca7
commit
fb97bf1768
@ -1,3 +1,4 @@
|
||||
var CT_VBA = "application/vnd.ms-office.vbaProject";
|
||||
function make_vba_xls(cfb/*:CFBContainer*/) {
|
||||
var newcfb = CFB.utils.cfb_new({root:"R"});
|
||||
cfb.FullPaths.forEach(function(p, i) {
|
||||
|
@ -169,7 +169,7 @@ function parse_zip(zip/*:ZIP*/, opts/*:?ParseOpts*/)/*:Workbook*/ {
|
||||
}
|
||||
if(opts.bookVBA) {
|
||||
if(dir.vba.length > 0) out.vbaraw = getzipdata(zip,strip_front_slash(dir.vba[0]),true);
|
||||
else if(dir.defaults && dir.defaults.bin === 'application/vnd.ms-office.vbaProject') out.vbaraw = getzipdata(zip,'xl/vbaProject.bin',true);
|
||||
else if(dir.defaults && dir.defaults.bin === CT_VBA) out.vbaraw = getzipdata(zip, 'xl/vbaProject.bin',true);
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
5
test.js
5
test.js
@ -591,7 +591,10 @@ describe('parse options', function() {
|
||||
var wb = X.read(fs.readFileSync(p), {type:TYPE}); assert(typeof wb.vbaraw === 'undefined');
|
||||
}); });
|
||||
it('bookVBA should generate vbaraw', function() { NFVBA.forEach(function(p) {
|
||||
var wb = X.read(fs.readFileSync(p),{type:TYPE, bookVBA:true}); assert(wb.vbaraw);
|
||||
var wb = X.read(fs.readFileSync(p),{type: TYPE, bookVBA: true});
|
||||
assert(wb.vbaraw);
|
||||
var cfb = X.CFB.read(wb.vbaraw, {type: 'array'});
|
||||
assert(X.CFB.find(cfb, '/VBA/ThisWorkbook'));
|
||||
}); });
|
||||
});
|
||||
});
|
||||
|
5
tests/core.js
generated
5
tests/core.js
generated
@ -591,7 +591,10 @@ describe('parse options', function() {
|
||||
var wb = X.read(fs.readFileSync(p), {type:TYPE}); assert(typeof wb.vbaraw === 'undefined');
|
||||
}); });
|
||||
it('bookVBA should generate vbaraw', function() { NFVBA.forEach(function(p) {
|
||||
var wb = X.read(fs.readFileSync(p),{type:TYPE, bookVBA:true}); assert(wb.vbaraw);
|
||||
var wb = X.read(fs.readFileSync(p),{type: TYPE, bookVBA: true});
|
||||
assert(wb.vbaraw);
|
||||
var cfb = X.CFB.read(wb.vbaraw, {type: 'array'});
|
||||
assert(X.CFB.find(cfb, '/VBA/ThisWorkbook'));
|
||||
}); });
|
||||
});
|
||||
});
|
||||
|
@ -9175,6 +9175,7 @@ function write_comments_bin(data/*::, opts*/) {
|
||||
write_record(ba, "BrtEndComments");
|
||||
return ba.end();
|
||||
}
|
||||
var CT_VBA = "application/vnd.ms-office.vbaProject";
|
||||
function make_vba_xls(cfb/*:CFBContainer*/) {
|
||||
var newcfb = CFB.utils.cfb_new({root:"R"});
|
||||
cfb.FullPaths.forEach(function(p, i) {
|
||||
@ -18775,7 +18776,7 @@ function parse_zip(zip/*:ZIP*/, opts/*:?ParseOpts*/)/*:Workbook*/ {
|
||||
}
|
||||
if(opts.bookVBA) {
|
||||
if(dir.vba.length > 0) out.vbaraw = getzipdata(zip,strip_front_slash(dir.vba[0]),true);
|
||||
else if(dir.defaults && dir.defaults.bin === 'application/vnd.ms-office.vbaProject') out.vbaraw = getzipdata(zip,'xl/vbaProject.bin',true);
|
||||
else if(dir.defaults && dir.defaults.bin === CT_VBA) out.vbaraw = getzipdata(zip, 'xl/vbaProject.bin',true);
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
3
xlsx.js
generated
3
xlsx.js
generated
@ -9081,6 +9081,7 @@ function write_comments_bin(data) {
|
||||
write_record(ba, "BrtEndComments");
|
||||
return ba.end();
|
||||
}
|
||||
var CT_VBA = "application/vnd.ms-office.vbaProject";
|
||||
function make_vba_xls(cfb) {
|
||||
var newcfb = CFB.utils.cfb_new({root:"R"});
|
||||
cfb.FullPaths.forEach(function(p, i) {
|
||||
@ -18665,7 +18666,7 @@ function parse_zip(zip, opts) {
|
||||
}
|
||||
if(opts.bookVBA) {
|
||||
if(dir.vba.length > 0) out.vbaraw = getzipdata(zip,strip_front_slash(dir.vba[0]),true);
|
||||
else if(dir.defaults && dir.defaults.bin === 'application/vnd.ms-office.vbaProject') out.vbaraw = getzipdata(zip,'xl/vbaProject.bin',true);
|
||||
else if(dir.defaults && dir.defaults.bin === CT_VBA) out.vbaraw = getzipdata(zip, 'xl/vbaProject.bin',true);
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user