def __get_cell_style(self, col):
if col in self.__col_style_table:
return self.__col_style_table.get(col)
try:
col_dp = self._column_dp_list[col]
except KeyError:
return {}
if col_dp.typecode not in [typepy.Typecode.REAL_NUMBER]:
raise ValueError()
if not Integer(col_dp.minmax_decimal_places.max_value).is_type():
raise ValueError()
float_digit = col_dp.minmax_decimal_places.max_value
if float_digit <= 0:
raise ValueError()
num_format_str = "#,{:s}0.{:s}".format(
"#" * int(float_digit), "0" * int(float_digit))
cell_style = xlwt.easyxf(num_format_str=num_format_str)
self.__col_style_table[col] = cell_style
return cell_style
评论列表
文章目录