修改文件:
Python.3.9\LocalCache\local-packages\Python39\site-packages\xlsxwriter\drawing.py
参照:
"Python.3.9\LocalCache\local-packages\Python39\site-packages\xlsxwriter\chart.py"(3260,33): self._write_a_alpha(transparency)
文本框属性
tx_props = {
'width': width,
'height': height,
'fill': {'color': '#f6f6f6', 'transparency': 20},
'border': {'color': '#000000', 'width': 1},
'align': {'vertical': 'middle', 'horizontal': 'left'},
'font': {'bold': False, 'name': u'微软雅黑', 'size': 12},
}
函数_write_xdr_sp_pr
片段
...
if shape.fill:
if not shape.fill['defined']:
# Write the a:solidFill element.
self._write_a_solid_fill_scheme('lt1')
elif 'none' in shape.fill:
# Write the a:noFill element.
self._xml_empty_tag('a:noFill')
elif 'color' in shape.fill:
# Write the a:solidFill element.
transparency = shape.fill.get('transparency', None)
self._write_a_solid_fill(get_rgb_color(shape.fill['color']), transparency)
...
def _write_a_solid_fill(self, rgb, transparency=None):
# Write the <a:solidFill> element.
if rgb is None:
rgb = 'FFFFFF'
self._xml_start_tag('a:solidFill')
# Write the a:srgbClr element.
self._write_a_srgb_clr(rgb, transparency)
self._xml_end_tag('a:solidFill')
def _write_a_srgb_clr(self, val, transparency=None):
# Write the <a:srgbClr> element.
attributes = [('val', val)]
if transparency:
self._xml_start_tag('a:srgbClr', attributes)
# Write the a:alpha element.
self._write_a_alpha(transparency)
self._xml_end_tag('a:srgbClr')
else:
self._xml_empty_tag('a:srgbClr', attributes)
def _write_a_alpha(self, val):
# Write the <a:alpha> element.
val = int((100 - int(val)) * 1000)
attributes = [('val', val)]
self._xml_empty_tag('a:alpha', attributes)