Skip to content

Commit

Permalink
getCellValue now returns computed value, instead of function
Browse files Browse the repository at this point in the history
  • Loading branch information
KeeTraxx committed Sep 21, 2015
1 parent c1fec12 commit eeaee07
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 2 deletions.
2 changes: 2 additions & 0 deletions lib/Sheet.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,8 @@ function Sheet(basedir, file, contents, sharedStrings) {
if (cell) {
if (cell.$.t == 's') {
return sharedStrings[parseInt(cell.v)].t[0];
} else if(cell.f && cell.v) {
return cell.v[0];
} else if (cell.f) {
// formula
return '=' + cell.f[0];
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "kexcel",
"version": "2.0.11",
"version": "2.0.12",
"description": "Create or open and then edit existing XLSX files",
"keywords": [
"xlsx",
Expand Down
21 changes: 21 additions & 0 deletions test/functionvalues.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
var chai = require('chai');
var fs = require('fs');
var path = require('path');
var should = chai.should();
var kexcel = require('..');


describe('Return values instead of functions', function () {
var workbook;
it('Open a input file...', function (done) {
kexcel.open(path.join(__dirname, 'input-files', '42.xlsx'), function (err, wb) {
workbook = wb;
done();
});
});

it('Get the value', function () {
workbook.getSheet(0).getCellValue(1,1).should.equal('42');
});

});
Binary file added test/input-files/42.xlsx
Binary file not shown.
1 change: 0 additions & 1 deletion test/kexcel-new.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ describe('Basic kexcel sheet test', function () {

it('Append a row', function () {
workbook.getSheet(0).appendRow(['Forty', 'Three']);
console.log(workbook.getSheet(0).getLastRowNumber());
workbook.getSheet(0).getLastRowNumber().should.equal(43);
workbook.getSheet(0).getCellValue(3, 2).should.equal('two');
});
Expand Down

0 comments on commit eeaee07

Please sign in to comment.