问题描述
我正在尝试使用xlsxwriter
来使具有条件格式的数据栏的表的轮廓突出。由于某些原因,这仅在我指定不带可选参数或仅带有颜色更改参数的代码时才起作用。其他参数均不起作用('data_bars_2010','bar_direction','bar_negative_color_same')
。
文档Working with Conditional Formatting说您需要excel 2010或更高版本,而我目前正在使用2013版本。可能与我的xlsxwriter
版本不最新有关。
就代码而言:此基本示例有效:
worksheet8.conditional_format('B3:B14',{'type': 'data_bar'})
worksheet8.conditional_format('F3:F14',{'type': 'data_bar','bar_color': '#63C384'})
但是这些更具风格的选项不起作用,并且根本没有显示条形图。
worksheet8.conditional_format('J3:J14','bar_direction': 'right'})
worksheet8.conditional_format('L3:L14','data_bar_2010': True})
worksheet8.conditional_format('M3:N14','bar_negative_color_same': True,'bar_negative_border_color_same': True})
解决方法
您完全正确。一旦我更新到xlsxwriter 1.3.3,数据栏就起作用了!