I have a problem when using the python library-3.11.9, spire.xls-14.7.3. I am hosting a linux server bot, however, an error appears when it starts. I use the library to convert a table to a photo. Help please.
code:
- Code: Select all
def create_image_from_excel(number):
week_number = get_week_number() + number
img_filename = f"week-{week_number}.jpg"
if os.path.exists(img_filename):
return
process_excel_file(number)
zip_file = 'Fonts.rar'
with zipfile.ZipFile("Fonts.zip","r") as zip_ref:
zip_ref.extractall(os.getcwd())
workbook = Workbook()
font_dir = os.path.join(os.getcwd(), 'Fonts')
workbook.CustomFontFileDirectory = font_dir
workbook.LoadFromFile('dz.xlsx')
sheet = workbook.Worksheets[f"week-{week_number}"]
image = sheet.ToImage(1, 1, 10, 9)
image.Save(img_filename)
workbook.Dispose()
and error:
- Code: Select all
spire.xls.common.SpireException: Cannot found font installed on the system.: at sprb2j.spragd(String, sprj, String) + 0xa3
at sprdi9.spra(String, sprj, String) + 0x2ae
at sprdxs.spra(String, Double, Double) + 0x206
at sprdjm.sprz(Int32) + 0x2f
at spre23.sprb() + 0x10f
at spre23.spre(sprdlp) + 0xab
at spre23.sprc(sprdlp) + 0x5c2
at spre23.spra(Int32) + 0x69
at spre3h.spra(ConverterSetting, Int32&) + 0x4f6
at spre3i..ctor(sprdlm, ConverterSetting, sprdln, sprfl1) + 0x10a
at Spire.Xls.Core.Spreadsheet.XlsWorkbook.spra(Int32, Int32, Int32, Int32, Int32, Single, Single, sprbcb&, Stream&) + 0x8fb
at Spire.Xls.Core.Spreadsheet.XlsWorkbook.SaveAsImagesInternal(Int32, Int32, Int32, Int32, Int32, Single, Single) + 0x2b
at Spire.Xls.Core.Spreadsheet.XlsWorksheet.ToImage(Int32, Int32, Int32, Int32) + 0xd0
at Spire.Xls.AOT.NLXlsWorksheet.XlsWorksheet_ToImage(IntPtr, Int32, Int32, Int32, Int32, IntPtr) + 0x6f
Data and Fonts in GitHub Amir10202010/dz-bot
Best regards,
Amirkhan