|
|
@@ -6,7 +6,7 @@ import re
|
|
6
|
6
|
|
|
7
|
7
|
from openpyxl.drawing.spreadsheet_drawing import AbsoluteAnchor
|
|
8
|
8
|
from openpyxl.drawing.xdr import XDRPoint2D, XDRPositiveSize2D
|
|
9
|
|
-from openpyxl.utils.units import pixels_to_EMU
|
|
|
9
|
+from openpyxl.utils.units import pixels_to_EMU, pixels_to_points
|
|
10
|
10
|
from openpyxl.utils import get_column_letter, column_index_from_string
|
|
11
|
11
|
from django.db import models
|
|
12
|
12
|
import os
|
|
|
@@ -212,7 +212,9 @@ def gen_xlsx(template_file, selected_sheets, prefix_filename, data):
|
|
212
|
212
|
|
|
213
|
213
|
elif value is True:
|
|
214
|
214
|
img = Image(checked_image_path)
|
|
215
|
|
- img.width = img.height = 10
|
|
|
215
|
+ img.width = img.height = pixels_to_points(15)
|
|
|
216
|
+ # img.width = 15
|
|
|
217
|
+ # img.hegiht = 10
|
|
216
|
218
|
print(f"{cell.coordinate}")
|
|
217
|
219
|
# sheet.add_image(img, cell.coordinate)
|
|
218
|
220
|
# set_image_with_offset(sheet, img, cell.coordinate, offset_x=100)
|
|
|
@@ -220,7 +222,9 @@ def gen_xlsx(template_file, selected_sheets, prefix_filename, data):
|
|
220
|
222
|
cell.value = None # Remove the placeholder text
|
|
221
|
223
|
elif value is False:
|
|
222
|
224
|
img = Image(unchecked_image_path)
|
|
223
|
|
- img.width = img.height = 10
|
|
|
225
|
+ # img.width = 15
|
|
|
226
|
+ # img.height = 10
|
|
|
227
|
+ img.width = img.height = pixels_to_points(15)
|
|
224
|
228
|
# sheet.add_image(img, cell.coordinate)
|
|
225
|
229
|
# set_image_with_offset(sheet, img, cell.coordinate, offset_x=100)
|
|
226
|
230
|
center_image_in_cell(sheet, img, cell.coordinate, )
|