_excel.py 文件源码

python
阅读 18 收藏 0 点赞 0 评论 0

项目:pytablewriter 作者: thombashi 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号