提交 fb97bf17 编写于 作者: M Maxim Kukhtenkov

VBA CFB test [ci skip]

上级 75845a0c
var CT_VBA = "application/vnd.ms-office.vbaProject";
function make_vba_xls(cfb/*:CFBContainer*/) { function make_vba_xls(cfb/*:CFBContainer*/) {
var newcfb = CFB.utils.cfb_new({root:"R"}); var newcfb = CFB.utils.cfb_new({root:"R"});
cfb.FullPaths.forEach(function(p, i) { cfb.FullPaths.forEach(function(p, i) {
......
...@@ -169,7 +169,7 @@ function parse_zip(zip/*:ZIP*/, opts/*:?ParseOpts*/)/*:Workbook*/ { ...@@ -169,7 +169,7 @@ function parse_zip(zip/*:ZIP*/, opts/*:?ParseOpts*/)/*:Workbook*/ {
} }
if(opts.bookVBA) { if(opts.bookVBA) {
if(dir.vba.length > 0) out.vbaraw = getzipdata(zip,strip_front_slash(dir.vba[0]),true); 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; return out;
} }
......
...@@ -591,7 +591,10 @@ describe('parse options', function() { ...@@ -591,7 +591,10 @@ describe('parse options', function() {
var wb = X.read(fs.readFileSync(p), {type:TYPE}); assert(typeof wb.vbaraw === 'undefined'); var wb = X.read(fs.readFileSync(p), {type:TYPE}); assert(typeof wb.vbaraw === 'undefined');
}); }); }); });
it('bookVBA should generate vbaraw', function() { NFVBA.forEach(function(p) { 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'));
}); }); }); });
}); });
}); });
......
此差异由.gitattributes 抑制。
...@@ -9175,6 +9175,7 @@ function write_comments_bin(data/*::, opts*/) { ...@@ -9175,6 +9175,7 @@ function write_comments_bin(data/*::, opts*/) {
write_record(ba, "BrtEndComments"); write_record(ba, "BrtEndComments");
return ba.end(); return ba.end();
} }
var CT_VBA = "application/vnd.ms-office.vbaProject";
function make_vba_xls(cfb/*:CFBContainer*/) { function make_vba_xls(cfb/*:CFBContainer*/) {
var newcfb = CFB.utils.cfb_new({root:"R"}); var newcfb = CFB.utils.cfb_new({root:"R"});
cfb.FullPaths.forEach(function(p, i) { cfb.FullPaths.forEach(function(p, i) {
...@@ -18775,7 +18776,7 @@ function parse_zip(zip/*:ZIP*/, opts/*:?ParseOpts*/)/*:Workbook*/ { ...@@ -18775,7 +18776,7 @@ function parse_zip(zip/*:ZIP*/, opts/*:?ParseOpts*/)/*:Workbook*/ {
} }
if(opts.bookVBA) { if(opts.bookVBA) {
if(dir.vba.length > 0) out.vbaraw = getzipdata(zip,strip_front_slash(dir.vba[0]),true); 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; return out;
} }
......
此差异由.gitattributes 抑制。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册