mirror of
https://github.com/gnh1201/welsonjs.git
synced 2025-02-06 15:04:58 +00:00
Update excel.js and relative files
This commit is contained in:
parent
4fa3937170
commit
51ec5be448
|
@ -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
|
||||
|
||||
|
|
|
@ -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
51
lib/excel.js
Normal 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;
|
||||
};
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue
Block a user