-
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change the calling convention
excel.getCellByPosition()
to `excel.g…
…etCellByPosition(x, y).setValue()`
- Loading branch information
Showing
2 changed files
with
27 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 = "[email protected]"; | ||
exports.global = global; | ||
exports.require = global.require; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters