XlsxWriter:根据 Excel 2016 设计指定绘图样式
XlsxWriter: specifying plot style in terms of Excel 2016 designs
我正在尝试使用 Python 和 XlsxWriter 模块在 Excel 2016(版本很重要)中创建某种风格的情节。可以在此处找到我们可以使用的可重现代码示例:http://xlsxwriter.readthedocs.io/example_chart_simple.html。
预期结果
我想要的是在 Excel 2016 中使用 Style 3
(例如)样式的图形,可以从单击时出现的 Design
菜单中选择在图上。请注意,我添加了数据标签,但这些与问题无关:
已完成的步骤
从 XlsxWriter 的文档中可以明显看出,方法 chart.set_style()
(http://xlsxwriter.readthedocs.io/chart.html#set_style) 可能就是我们所需要的。不幸的是,这种方法似乎并没有根据 Excel 2016 来操纵样式。相反,它似乎影响了 Excel 2016 中菜单 Design -> Change colors
下的配色方案,例如:
甚至产生一些我认为可能来自早期 Excel 版本的其他样式,因为这些样式在 Excel 2016 年似乎并未作为预设样式实现,例如:
我想知道是否有可能以某种方式设置特定于 Excel 2016 的绘图样式。提前感谢您的任何见解。
这在 set_style() 文档中有解释:
Note
In Excel 2013 the Styles section of the 'Design' tab in Excel shows what were referred to as 'Layouts; in previous versions of Excel. These layouts are not defined in the file format. They are a collection of modifications to the base chart type. They can be replicated using the XlsxWriter Chart API but they cannot be defined by the set_style()
method.
这也适用于 Excel 2016 年。
很遗憾,没有快速的单一方法调用来获取您需要的格式。您需要找出 Excel 应用的样式元素并通过 XlsxWriter API 应用它们。几乎 Excel 图表格式在 XlsxWriter 中可用。
我正在尝试使用 Python 和 XlsxWriter 模块在 Excel 2016(版本很重要)中创建某种风格的情节。可以在此处找到我们可以使用的可重现代码示例:http://xlsxwriter.readthedocs.io/example_chart_simple.html。
预期结果
我想要的是在 Excel 2016 中使用 Style 3
(例如)样式的图形,可以从单击时出现的 Design
菜单中选择在图上。请注意,我添加了数据标签,但这些与问题无关:
已完成的步骤
从 XlsxWriter 的文档中可以明显看出,方法 chart.set_style()
(http://xlsxwriter.readthedocs.io/chart.html#set_style) 可能就是我们所需要的。不幸的是,这种方法似乎并没有根据 Excel 2016 来操纵样式。相反,它似乎影响了 Excel 2016 中菜单 Design -> Change colors
下的配色方案,例如:
甚至产生一些我认为可能来自早期 Excel 版本的其他样式,因为这些样式在 Excel 2016 年似乎并未作为预设样式实现,例如:
我想知道是否有可能以某种方式设置特定于 Excel 2016 的绘图样式。提前感谢您的任何见解。
这在 set_style() 文档中有解释:
Note
In Excel 2013 the Styles section of the 'Design' tab in Excel shows what were referred to as 'Layouts; in previous versions of Excel. These layouts are not defined in the file format. They are a collection of modifications to the base chart type. They can be replicated using the XlsxWriter Chart API but they cannot be defined by the
set_style()
method.
这也适用于 Excel 2016 年。
很遗憾,没有快速的单一方法调用来获取您需要的格式。您需要找出 Excel 应用的样式元素并通过 XlsxWriter API 应用它们。几乎 Excel 图表格式在 XlsxWriter 中可用。