Update excel.js and relative files

This commit is contained in:
Namhyeon Go 2020-07-27 17:14:39 +09:00
parent 4fa3937170
commit 51ec5be448
4 changed files with 59 additions and 6 deletions

View File

@ -32,6 +32,7 @@ WelsonJS - Build a Windows desktop apps with JavaScript, HTML, and CSS based on
- lib/autoit3 ([AutoIt3](https://catswords.re.kr/go/autoit3) interface)
- lib/cloudflare ([Cloudflare Argo Tunnel](https://catswords.re.kr/go/argotunnel) interface)
- lib/shadowsocks ([Shadowsocks](https://catswords.re.kr/go/shadowsocks) interface)
- lib/excel (Microsoft Excel interface)
## Make your own `sayhello` example

View File

@ -32,6 +32,7 @@ WelsonJS - Build a Windows desktop apps with JavaScript, HTML, and CSS based on
- lib/autoit3 ([AutoIt3](https://catswords.re.kr/go/autoit3) interface)
- lib/cloudflare ([Cloudflare Argo Tunnel](https://catswords.re.kr/go/argotunnel) interface)
- lib/shadowsocks ([Shadowsocks](https://catswords.re.kr/go/shadowsocks) interface)
- lib/excel (Microsoft Excel interface)
## Make your own `sayhello` example

51
lib/excel.js Normal file
View File

@ -0,0 +1,51 @@
//////////////////////////////////////////////////////////////////////////////////
//
// excel.js
//
/////////////////////////////////////////////////////////////////////////////////
var FILE = require("lib/file");
exports.createExcelFile = function(filename) {
var success = false;
try {
var objExcel = CreateObject("Excel.Application");
objExcel.visible = true;
var objWorkbook = objExcel.workbooks.add();
if(!FILE.fileExists(filename)) {
objWorkbook.saveAs(filename);
success = FILE.fileExists(filename);
}
objWorkbook.close();
objExcel.quit();
} catch(e){}
return success;
};
exports.openExcelFile = function(filename, callback) {
var success = false;
if(FILE.fileExists(filename)) {
try {
var objExcel = CreateObject("Excel.Application");
objExcel.visible = true;
var objWorkbook = objExcel.workbooks.open(filename);
if (typeof(callback) !== "undefined") {
success = callback(objWorkbook);
} else {
success = true;
}
objWorkbook.close();
objExcel.quit();
} catch(e){}
}
return success;
};

View File

@ -4,13 +4,13 @@
inform('Starting...');
},
tearDown: function() {
inform('Finishing...')
},
tearDown: function() {
inform('Finishing...')
},
testGreenTest: function () {
assert("this is true", true);
},
testGreenTest: function () {
assert("this is true", true);
},
testRedTest: function () {
assert("this is false", false);