From 3995e9034a471e625f6d57fb2cbfa9e8f2c79345 Mon Sep 17 00:00:00 2001 From: felschatz <58936925+felschatz@users.noreply.github.com> Date: Tue, 23 Apr 2024 13:33:29 +0200 Subject: [PATCH 1/2] Set font to bold according to font weight --- xls2xlsx/xls2xlsx.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/xls2xlsx/xls2xlsx.py b/xls2xlsx/xls2xlsx.py index 5d96d5b..a85f1e7 100644 --- a/xls2xlsx/xls2xlsx.py +++ b/xls2xlsx/xls2xlsx.py @@ -113,7 +113,8 @@ def xls_style_to_xlsx(self, xf_ndx): try: # Avoidance for issue #11 (though I cannot duplicate the problem w/o the input file) xls_font = self.book.font_list[xf.font_index] # Font object - font.b = xls_font.bold + if (xls_font.bold or xls_font.weight == 700): # 700 is equal to bold according to https://xlrd.readthedocs.io/en/latest/api.html + font.b = True font.i = xls_font.italic if xls_font.character_set: font.charset = xls_font.character_set From 6bd691d0982eb8489513e373e4438f766df68098 Mon Sep 17 00:00:00 2001 From: felschatz <58936925+felschatz@users.noreply.github.com> Date: Tue, 23 Apr 2024 13:44:17 +0200 Subject: [PATCH 2/2] Added else case --- xls2xlsx/xls2xlsx.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/xls2xlsx/xls2xlsx.py b/xls2xlsx/xls2xlsx.py index a85f1e7..ab06561 100644 --- a/xls2xlsx/xls2xlsx.py +++ b/xls2xlsx/xls2xlsx.py @@ -115,6 +115,8 @@ def xls_style_to_xlsx(self, xf_ndx): xls_font = self.book.font_list[xf.font_index] # Font object if (xls_font.bold or xls_font.weight == 700): # 700 is equal to bold according to https://xlrd.readthedocs.io/en/latest/api.html font.b = True + else: + font.b = False font.i = xls_font.italic if xls_font.character_set: font.charset = xls_font.character_set