Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Support empty input data.

  • Loading branch information...
commit 5c6c859505d7b4d7d7f6a2072f144a695ca07598 1 parent 1fee883
@rubenv authored
View
5 src/index.coffee
@@ -112,6 +112,11 @@ class XlsxWriter
if @cellLabelMap[col]
colIndex = @cellLabelMap[col]
else
+ if col == 0
+ # Provide a fallback for empty spreadsheets
+ row = 1
+ col = 1
+
input = (+col - 1).toString(26)
while input.length
a = input.charCodeAt(input.length - 1)
View
2  test/common.coffee
@@ -25,12 +25,14 @@ module.exports = (name, data) ->
it 'Should have header row', ->
assert(result.length >= 1, "Should have header row")
+ return if !data[0]
for key, index in _.keys(data[0])
assert.equal(result[0][index], key)
it 'Should contain right values', ->
assert.equal(result.length, data.length + 1)
+ return if !data[0]
for row, rowNr in result
continue if rowNr == 0 # Header
View
3  test/dimensions_test.coffee
@@ -5,6 +5,9 @@ assert = require('assert')
describe 'Dimensions', ->
writer = new XlsxWriter('tmp.xslx')
+ it 'Calculates 0x0 dimensions', ->
+ assert.equal(writer.dimensions(0, 0), 'A1:A1')
+
it 'Calculates 1x1 dimensions', ->
assert.equal(writer.dimensions(1, 1), 'A1:A1')
View
4 test/empty_test.coffee
@@ -0,0 +1,4 @@
+test = require('./common')
+
+test 'empty-test', [
+]
Please sign in to comment.
Something went wrong with that request. Please try again.