Skip to content

Commit fb97bf1

Browse files
committed
VBA CFB test [ci skip]
1 parent 75845a0 commit fb97bf1

6 files changed

Lines changed: 14 additions & 5 deletions

File tree

bits/59_vba.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
var CT_VBA = "application/vnd.ms-office.vbaProject";
12
function make_vba_xls(cfb/*:CFBContainer*/) {
23
var newcfb = CFB.utils.cfb_new({root:"R"});
34
cfb.FullPaths.forEach(function(p, i) {

bits/85_parsezip.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ function parse_zip(zip/*:ZIP*/, opts/*:?ParseOpts*/)/*:Workbook*/ {
169169
}
170170
if(opts.bookVBA) {
171171
if(dir.vba.length > 0) out.vbaraw = getzipdata(zip,strip_front_slash(dir.vba[0]),true);
172-
else if(dir.defaults && dir.defaults.bin === 'application/vnd.ms-office.vbaProject') out.vbaraw = getzipdata(zip,'xl/vbaProject.bin',true);
172+
else if(dir.defaults && dir.defaults.bin === CT_VBA) out.vbaraw = getzipdata(zip, 'xl/vbaProject.bin',true);
173173
}
174174
return out;
175175
}

test.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -591,7 +591,10 @@ describe('parse options', function() {
591591
var wb = X.read(fs.readFileSync(p), {type:TYPE}); assert(typeof wb.vbaraw === 'undefined');
592592
}); });
593593
it('bookVBA should generate vbaraw', function() { NFVBA.forEach(function(p) {
594-
var wb = X.read(fs.readFileSync(p),{type:TYPE, bookVBA:true}); assert(wb.vbaraw);
594+
var wb = X.read(fs.readFileSync(p),{type: TYPE, bookVBA: true});
595+
assert(wb.vbaraw);
596+
var cfb = X.CFB.read(wb.vbaraw, {type: 'array'});
597+
assert(X.CFB.find(cfb, '/VBA/ThisWorkbook'));
595598
}); });
596599
});
597600
});

tests/core.js

Lines changed: 4 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

xlsx.flow.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9175,6 +9175,7 @@ function write_comments_bin(data/*::, opts*/) {
91759175
write_record(ba, "BrtEndComments");
91769176
return ba.end();
91779177
}
9178+
var CT_VBA = "application/vnd.ms-office.vbaProject";
91789179
function make_vba_xls(cfb/*:CFBContainer*/) {
91799180
var newcfb = CFB.utils.cfb_new({root:"R"});
91809181
cfb.FullPaths.forEach(function(p, i) {
@@ -18775,7 +18776,7 @@ function parse_zip(zip/*:ZIP*/, opts/*:?ParseOpts*/)/*:Workbook*/ {
1877518776
}
1877618777
if(opts.bookVBA) {
1877718778
if(dir.vba.length > 0) out.vbaraw = getzipdata(zip,strip_front_slash(dir.vba[0]),true);
18778-
else if(dir.defaults && dir.defaults.bin === 'application/vnd.ms-office.vbaProject') out.vbaraw = getzipdata(zip,'xl/vbaProject.bin',true);
18779+
else if(dir.defaults && dir.defaults.bin === CT_VBA) out.vbaraw = getzipdata(zip, 'xl/vbaProject.bin',true);
1877918780
}
1878018781
return out;
1878118782
}

xlsx.js

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)