@@ -41,10 +41,8 @@ def column_iterator(self, row):
41
41
42
42
43
43
class MergedCell (object ):
44
- def __init__ (self , cell_ranges_str ):
45
- topleft , bottomright = cell_ranges_str .split (':' )
46
- self .__rl , self .__cl = convert_coordinate (topleft )
47
- self .__rh , self .__ch = convert_coordinate (bottomright )
44
+ def __init__ (self , cell_ranges ):
45
+ self .__cl , self .__rl , self .__ch , self .__rh = cell_ranges .bounds
48
46
self .value = None
49
47
50
48
def register_cells (self , registry ):
@@ -60,13 +58,6 @@ def right_column(self):
60
58
return self .__ch
61
59
62
60
63
- def convert_coordinate (cell_coordinate_with_letter ):
64
- xy = openpyxl .utils .coordinate_from_string (cell_coordinate_with_letter )
65
- col = openpyxl .utils .column_index_from_string (xy [0 ])
66
- row = xy [1 ]
67
- return row , col
68
-
69
-
70
61
class SlowSheet (FastSheet ):
71
62
"""
72
63
This sheet will be slower because it does not use readonly sheet
@@ -78,8 +69,8 @@ def __init__(self, sheet, **keywords):
78
69
self .max_column = 0
79
70
self .__sheet_max_row = sheet .max_row
80
71
self .__sheet_max_column = sheet .max_column
81
- for ranges_str in sheet .merged_cell_ranges :
82
- merged_cells = MergedCell (ranges_str )
72
+ for ranges in sheet .merged_cells . ranges [:] :
73
+ merged_cells = MergedCell (ranges )
83
74
merged_cells .register_cells (self .__merged_cells )
84
75
if self .max_row < merged_cells .bottom_row ():
85
76
self .max_row = merged_cells .bottom_row ()
@@ -155,7 +146,7 @@ def open_stream(self, file_stream, skip_hidden_sheets=True,
155
146
self ._load_the_excel_file (file_stream )
156
147
157
148
def read_sheet_by_name (self , sheet_name ):
158
- sheet = self ._native_book . get_sheet_by_name ( sheet_name )
149
+ sheet = self ._native_book [ sheet_name ]
159
150
if sheet is None :
160
151
raise ValueError ("%s cannot be found" % sheet_name )
161
152
else :
0 commit comments