Skip to content

Commit

Permalink
VBA CFB test [ci skip]
Browse files Browse the repository at this point in the history
  • Loading branch information
maxim-kht committed Feb 5, 2018
1 parent 75845a0 commit fb97bf1
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 5 deletions.
1 change: 1 addition & 0 deletions bits/59_vba.js
Original file line number Diff line number Diff line change
@@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion bits/85_parsezip.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
5 changes: 4 additions & 1 deletion test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'));
}); });
});
});
Expand Down
5 changes: 4 additions & 1 deletion tests/core.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion xlsx.flow.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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;
}
Expand Down
3 changes: 2 additions & 1 deletion xlsx.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit fb97bf1

Please sign in to comment.