def data_style_func(self, i, c): number_format = '_($* #,##0_);_($* (#,##0);_($* "-"??_);_(@_)' if c == 'b': return OpenPyxlStyleHelper.get_style( number_format=number_format, border=OpenPyxlStyleHelper.CustomBorders.thin_black_border) if self.df.loc[i, c] >= 0.2 and c == 'a': return OpenPyxlStyleHelper.get_style( bg_color='B8B8B8', border=OpenPyxlStyleHelper.CustomBorders.thin_black_border) return OpenPyxlStyleHelper.get_style( border=OpenPyxlStyleHelper.CustomBorders.thin_black_border)
def header_style_func(node): bg_color = 'FFFFFF' if node.key == ('A',) or node.key == ('B',): bg_color = '9E80B8' elif node.key[1] == 'x': bg_color = '4F90C1' elif node.key[1] == 'y': bg_color = '6DC066' return OpenPyxlStyleHelper.get_style(bg_color=bg_color)
def index_style_func(self, node): color = 'FFFF00' if node.value == 'a': color = '9BC2E6' if node.value == 'b': color = 'A9D08E' return OpenPyxlStyleHelper.get_style( bg_color=color, border=OpenPyxlStyleHelper.CustomBorders.thin_black_border)
def index_style_func(node): # node.key here could be one of (1,), (1, 100), (2,), (2, 100), (2, 200) bg_color = 'FFFFFF' if node.key == (1,) or node.key == (2,): bg_color = '9E80B8' elif node.key[1] == 100: bg_color = '4F90C1' elif node.key[1] == 200: bg_color = '6DC066' return OpenPyxlStyleHelper.get_style(bg_color=bg_color)
def style_func(idx, col): if col == 'b': return OpenPyxlStyleHelper.get_style(number_format='0.00%') else: # for 'a' we do dollar format return OpenPyxlStyleHelper.get_style(number_format='$#,##.00')
def index_name_style_func(self, node): color = '9BC2E6' return OpenPyxlStyleHelper.get_style( bg_color=color, border=OpenPyxlStyleHelper.CustomBorders.thin_black_border)
def data_style_func_column_level(self, c): return OpenPyxlStyleHelper.get_style( number_format=NUMBER_FORMAT, border=OpenPyxlStyleHelper.CustomBorders.thin_black_border)