更新签名图片加载逻辑
This commit is contained in:
@@ -293,17 +293,17 @@ class ExcelReader:
|
|||||||
|
|
||||||
def _load_signature_images(self):
|
def _load_signature_images(self):
|
||||||
signature_cells = {
|
signature_cells = {
|
||||||
"major_director_signature_image": "K34",
|
"major_director_signature_image": ("I34", "K34"),
|
||||||
"course_leader_signature_image": "K35",
|
"course_leader_signature_image": ("I35", "K35"),
|
||||||
}
|
}
|
||||||
wb_with_images: Workbook = openpyxl.load_workbook(self.file_path, data_only=True)
|
wb_with_images: Workbook = openpyxl.load_workbook(self.file_path, data_only=True)
|
||||||
try:
|
try:
|
||||||
sheet_with_images: Worksheet = wb_with_images["初始录入"]
|
sheet_with_images: Worksheet = wb_with_images["初始录入"]
|
||||||
loader = self._SheetImageLoader(sheet_with_images)
|
loader = self._SheetImageLoader(sheet_with_images)
|
||||||
|
|
||||||
for attr, cell in signature_cells.items():
|
for attr, (check_cell, image_cell) in signature_cells.items():
|
||||||
if loader.image_in(cell):
|
if sheet_with_images[check_cell].value and loader.image_in(image_cell):
|
||||||
setattr(self, attr, loader.get(cell))
|
setattr(self, attr, loader.get(image_cell))
|
||||||
else:
|
else:
|
||||||
setattr(self, attr, None)
|
setattr(self, attr, None)
|
||||||
finally:
|
finally:
|
||||||
|
|||||||
Reference in New Issue
Block a user