Skip to content
This repository has been archived by the owner on May 4, 2020. It is now read-only.

Commit

Permalink
Utils.py: minor tidy-ups.
Browse files Browse the repository at this point in the history
git-svn-id: https://secure.simplistix.co.uk/svn/xlwt/trunk@4881 ac150577-6901-3246-a117-cd8547e6756f
  • Loading branch information
sjmachin committed Feb 1, 2012
1 parent 976cf1f commit a7537b7
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions xlwt/Utils.py
Expand Up @@ -31,7 +31,6 @@
__rev_id__ = """$Id$"""

import re
from struct import pack
from ExcelMagic import MAX_ROW, MAX_COL


Expand All @@ -43,14 +42,14 @@


def col_by_name(colname):
"""
"""'A' -> 0, 'Z' -> 25, 'AA' -> 26, etc
"""
col = 0
pow = 1
power = 1
for i in xrange(len(colname)-1, -1, -1):
ch = colname[i]
col += (ord(ch) - ord('A') + 1) * pow
pow *= 26
col += (ord(ch) - ord('A') + 1) * power
power *= 26
return col - 1


Expand Down Expand Up @@ -165,7 +164,7 @@ def cellrange_to_rowcol_pair(cellrange):
if res:
row1, col1 = cell_to_rowcol2(res.group(1))
return row1, col1, row1, col1
raise Exception("Unknown cell reference %s" % (cell))
raise Exception("Unknown cell reference %s" % (cellrange))


def cell_to_packed_rowcol(cell):
Expand Down

0 comments on commit a7537b7

Please sign in to comment.