02656f91 by 周伟奇

fix bug f3

1 parent 72c57e42
...@@ -141,6 +141,7 @@ class Command(BaseCommand, LoggerMixin): ...@@ -141,6 +141,7 @@ class Command(BaseCommand, LoggerMixin):
141 sheet_name, key_field, side_field_order, src_field_order = self.field_map.get(c) 141 sheet_name, key_field, side_field_order, src_field_order = self.field_map.get(c)
142 if sheet_name in wb.sheetnames: 142 if sheet_name in wb.sheetnames:
143 ws = wb.get_sheet_by_name(sheet_name) 143 ws = wb.get_sheet_by_name(sheet_name)
144 ws.append((None,))
144 else: 145 else:
145 ws = wb.create_sheet(sheet_name) 146 ws = wb.create_sheet(sheet_name)
146 147
......
...@@ -30,13 +30,17 @@ class PDFBuild: ...@@ -30,13 +30,17 @@ class PDFBuild:
30 self.path = path 30 self.path = path
31 31
32 def insert_img(self, img_path_list): 32 def insert_img(self, img_path_list):
33 name = os.path.split(self.path)[-1]
33 if os.path.exists(self.path): 34 if os.path.exists(self.path):
34 pdf = fitz.Document(self.path) 35 pdf = fitz.Document(self.path)
35 else: 36 else:
36 pdf = fitz.Document() 37 pdf = fitz.Document()
37 for img_path in img_path_list: 38 for img_path in img_path_list:
38 new_page = pdf.newPage() 39 new_page = pdf.newPage()
39 new_page.insertImage(new_page.rect, img_path) 40 new_page.insertImage(new_page.rect, filename=img_path)
41 # print(pdf.name) filename or ''
42 # print(pdf.stream) None
43 pdf.name = name
40 pdf.save(self.path) 44 pdf.save(self.path)
41 pdf.close() 45 pdf.close()
42 46
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!