Allow multiple runs in axis title

Issue #648 invalid
Joseph Fox-Rabinovitz created an issue

I am trying to add a colored run of unicode characters to an axis title to simulate a simplified legend entry on a scatter plot.

from openpyxl import *
book = workbook.Workbook()
sheet =
chart = chart.ScatterChart()
# Add some data to the chart.
sheet.add_chart(chart, 'A1')

chart.y_axis.title = 'blah'

prop = drawing.text.CharacterProperties(solidFill='FF0000')
run = drawing.text.RegularTextRun(rPr=prop, t='\u00b7\u00b7\u00b7\u00b7')

There are a couple of issues here. The major one is that there is no way to append run above to the existing[0]. This could likely be fixed by changing

r = Typed(expected_type=RegularTextRun, allow_none=True)


r = Sequence(expected_type=RegularTextRun, allow_none=True)

on line 532 of drawing.text (Paragraph class), but I am not 100% sure about that. The minor issue is that the line prop = drawing.text.CharacterProperties(solidFill='00FF00') does not actually do anything.

By the way, before I append the new paragraph, I tried doing[-1].br = None

to simulate multiple runs by possibly eliminating the line break between paragraphs, but that did not appear to work at all (still got the label on two lines).

I am using OpenPyXL 2.3.2 on a CentOS 6.8 machine, viewing the results on Windows 7, MS Office Excel 2013.

Here is an output of what I am getting as well as what I am trying to achieve (ignore the data part of the plot):

Actual result


What I would like to see


Comments (2)

  1. Log in to comment