mirror of
https://github.com/gnh1201/welsonjs.git
synced 2025-03-11 16:35:13 +00:00
Change the calling convention excel.getCellByPosition()
to excel.getCellByPosition(x, y).setValue()
This commit is contained in:
parent
44c6e22dc8
commit
b87aad537a
|
@ -107,7 +107,7 @@ FileTypes.Word = [
|
|||
{"extension": [".xps"], "type": "XPS Document"}
|
||||
];
|
||||
|
||||
// Example: new Office.Excel()
|
||||
// EXAMPLE: new Office.Excel()
|
||||
function Excel() {
|
||||
this.Application = CreateObject("Excel.Application");
|
||||
this.Version = this.Application.Version;
|
||||
|
@ -174,25 +174,39 @@ function Excel() {
|
|||
return this;
|
||||
};
|
||||
|
||||
this.getValueByPosition = function(row, col) {
|
||||
return this.CurrentWorksheet.Cells(row, col).Value;
|
||||
};
|
||||
|
||||
this.setValueByPosition = function(row, col, value) {
|
||||
this.CurrentWorksheet.Cells(row, col).Value = value;
|
||||
|
||||
return this;
|
||||
this.getCellByPosition = function(row, col) {
|
||||
return new Excel.Cell(this.CurrentWorksheet.Cells(row, col));
|
||||
};
|
||||
};
|
||||
Excel.SupportedFileTypes = FileTypes.Excel;
|
||||
Excel.Cell = function(cell) {
|
||||
this.cell = cell;
|
||||
// EXAMPLE: excel.getCellByPosition(1, 3).setValue("Hello world!");
|
||||
this.setValue = function(value) {
|
||||
this.cell.Value = value;
|
||||
};
|
||||
this.getValue = function() {
|
||||
return this.cell.Value;
|
||||
};
|
||||
// EXAMPLE: excel.getCellByPosition(1, 3).setFormula("=SUM(A1:A2)");
|
||||
this.setFormula = function(formula) {
|
||||
if (formula.indexOf('=') != 0) {
|
||||
console.warn("Be careful because it may not be the correct formula.");
|
||||
}
|
||||
this.cell.Formula = formula;
|
||||
}
|
||||
this.getFormula = function() {
|
||||
return this.call.Formula;
|
||||
}
|
||||
};
|
||||
|
||||
// Example: new Office.PowerPoint()
|
||||
// EXAMPLE: new Office.PowerPoint()
|
||||
function PowerPoint() {
|
||||
this.Application = CreateObject("PowerPoint.Application");
|
||||
}
|
||||
PowerPoint.SupportedFileTypes = FileTypes.PowerPoint;
|
||||
|
||||
// Example: new Office.Word()
|
||||
// EXAMPLE: new Office.Word()
|
||||
function Word() {
|
||||
this.Application = CreateObject("Word.Application");
|
||||
}
|
||||
|
@ -202,7 +216,7 @@ exports.Excel = Excel;
|
|||
exports.PowerPoint = PowerPoint;
|
||||
exports.Word = Word;
|
||||
|
||||
exports.VERSIONINFO = "Microsoft Office interface (msoffice.js) version 0.1.3";
|
||||
exports.VERSIONINFO = "Microsoft Office interface (msoffice.js) version 0.1.4";
|
||||
exports.AUTHOR = "abuse@catswords.net";
|
||||
exports.global = global;
|
||||
exports.require = global.require;
|
||||
|
|
|
@ -49,7 +49,7 @@ function test() {
|
|||
questions.forEach(function(x) {
|
||||
var answer = ChatGPT.chat(x);
|
||||
console.log("받은 답변:", answer);
|
||||
excel.setValueByPosition(i, 1, answer);
|
||||
excel.getCellByPosition(i, 1).setValue(answer);
|
||||
i++;
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user