diff --git a/lib/msoffice.js b/lib/msoffice.js index 7ad75bf..7245a3d 100644 --- a/lib/msoffice.js +++ b/lib/msoffice.js @@ -175,23 +175,24 @@ function Excel() { return this; }; - this.setRange = function(range) { - this.range = range; - return this; + this.getRange = function(range) { + return new Excel.Range(this.currentWorksheet.Range(range)); }; - this.getCellByPosition = function(row, col) { - if (this.range == null) { - return new Excel.Cell(this.currentWorksheet.Cells(row, col)); - } else { - return new Excel.Cell(this.currentWorksheet.Range(this.range).Cells(row, col)); - } + this.getCell = function(row, col) { + return new Excel.Cell(this.currentWorksheet.Cells(row, col)); }; }; Excel.SupportedFileTypes = FileTypes.Excel; +Excel.Range = function(range) { + this.range = range; + this.getCell = function(row, col) { + return new Excel.Cell(this.range.Cells(row, col)); + }; +}; Excel.Cell = function(cell) { this.cell = cell; - // EXAMPLE: excel.getCellByPosition(1, 3).setValue("Hello world!"); + // EXAMPLE: excel.getCell(1, 3).setValue("Hello world!"); this.setValue = function(value) { this.cell.Value = value; }; @@ -226,7 +227,7 @@ exports.Excel = Excel; exports.PowerPoint = PowerPoint; exports.Word = Word; -exports.VERSIONINFO = "Microsoft Office interface (msoffice.js) version 0.1.6"; +exports.VERSIONINFO = "Microsoft Office interface (msoffice.js) version 0.1.7"; exports.AUTHOR = "abuse@catswords.net"; exports.global = global; exports.require = global.require;