Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

fix bug in writing blank cells to __cell, docs

  • Loading branch information...
commit 6b2a8ae10b7fa6cea8376ed11385d4237659dde2 1 parent 4eaab12
rupa rupa authored

Showing 2 changed files with 13 additions and 7 deletions. Show diff stats Hide diff stats

  1. +7 2 README.rst
  2. +6 5 xlsx/__init__.py
9 README.rst
Source Rendered
@@ -13,7 +13,7 @@ Usage
13 13
14 14 ::
15 15
16   - book = Workbook('filename or filedescriptor') #Open xlsx file
  16 + book = Workbook('filename or filedescriptor') # Open xlsx file
17 17 for sheet in book:
18 18 print sheet.name
19 19 for row, cells in sheet.rows().iteritems(): # or sheet.cols()
@@ -24,7 +24,12 @@ Usage
24 24 # or you can access the sheets by their name:
25 25
26 26 some_sheet = book['some sheet name']
27   - ...
  27 +
  28 + # rows, columns, and cells can be accessed directly from sheets
  29 +
  30 + some_sheet['AA'] # column AA
  31 + some_sheet['6'] # row 6
  32 + some_sheet['AA6'] # cell in column AA row 6
28 33
29 34 Alternatives
30 35 ------------
11 xlsx/__init__.py
@@ -147,19 +147,20 @@ def __load(self):
147 147 # fill in missing cells
148 148 col_idx = xlcol2num(colNum)
149 149 if not cell_ids and col_idx > 1:
150   - print colNum, 'first'
151 150 for i in range(1, col_idx):
152   - cell = Cell(rowNum, num2xlcol(i), u'', formula=None)
  151 + xlcol = num2xlcol(i)
  152 + cell = Cell(rowNum, xlcol, u'', formula=None)
153 153 rows[rowNum].append(cell)
154 154 columns[colNum].append(cell)
155   - self.__cells[u'{0}{1}'.format(colNum, rowNum)] = cell
  155 + self.__cells[u'{0}{1}'.format(xlcol, rowNum)] = cell
156 156 cell_ids.append(col_idx)
157 157 elif cell_ids and col_idx > cell_ids[-1] + 1:
158 158 for i in range(cell_ids[-1] + 1, col_idx):
159   - cell = Cell(rowNum, num2xlcol(i), u'', formula=None)
  159 + xlcol = num2xlcol(i)
  160 + cell = Cell(rowNum, xlcol, u'', formula=None)
160 161 rows[rowNum].append(cell)
161 162 columns[colNum].append(cell)
162   - self.__cells[u'{0}{1}'.format(colNum, rowNum)] = cell
  163 + self.__cells[u'{0}{1}'.format(xlcol, rowNum)] = cell
163 164 cell_ids.append(col_idx)
164 165
165 166 cell_ids.append(col_idx)

0 comments on commit 6b2a8ae

Please sign in to comment.
Something went wrong with that request. Please try again.