fix wb rebuild bug
Showing
1 changed file
with
3 additions
and
2 deletions
... | @@ -54,7 +54,7 @@ class BSWorkbook(Workbook): | ... | @@ -54,7 +54,7 @@ class BSWorkbook(Workbook): |
54 | # TODO 关键字段再次查找 | 54 | # TODO 关键字段再次查找 |
55 | if header_idx is None: | 55 | if header_idx is None: |
56 | continue | 56 | continue |
57 | letter = get_column_letter(header_idx) | 57 | letter = get_column_letter(col) |
58 | ws.move_range("{0}1:{0}{1}".format(letter, ws.max_row), cols=header_idx - col) | 58 | ws.move_range("{0}1:{0}{1}".format(letter, ws.max_row), cols=header_idx - col) |
59 | ws.delete_cols(self.fixed_col_amount + 1, amount=ws.max_column) | 59 | ws.delete_cols(self.fixed_col_amount + 1, amount=ws.max_column) |
60 | 60 | ||
... | @@ -147,8 +147,9 @@ class BSWorkbook(Workbook): | ... | @@ -147,8 +147,9 @@ class BSWorkbook(Workbook): |
147 | 147 | ||
148 | def build_month_sheet(self, role, month_mapping, ms): | 148 | def build_month_sheet(self, role, month_mapping, ms): |
149 | tmp_ws = self.create_sheet('tmp_ws') | 149 | tmp_ws = self.create_sheet('tmp_ws') |
150 | for month, parts in month_mapping.items(): | 150 | for month in sorted(month_mapping.keys()): |
151 | # 3.1.拷贝数据 | 151 | # 3.1.拷贝数据 |
152 | parts = month_mapping.get(month) | ||
152 | new_ws = self.create_sheet('{0}({1})'.format(month, role)) | 153 | new_ws = self.create_sheet('{0}({1})'.format(month, role)) |
153 | new_ws.append(self.fixed_headers) | 154 | new_ws.append(self.fixed_headers) |
154 | for part in parts: | 155 | for part in parts: | ... | ... |
-
Please register or sign in to post a comment