fix bug f3
Showing
2 changed files
with
6 additions
and
1 deletions
... | @@ -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 | ... | ... |
-
Please register or sign in to post a comment