It looks like pywin32 does not match the win32com API reference

Dario de Judicibus 6 Reputation points
2022-10-14T08:33:14.443+00:00

I am using pywin32 library to create charts from Excel data. I have created a scatter chart and now I have to add data labels to points. Looking at Win32Com API reference, I should be able to use DataLabel.Text to set the text, because is a read/write properties, but I get an exception.

data_label.Format.TextFrame2.TextRange.Text = f"({x_val:.2f},{y_val:.2f})"

works, whereas

data_label.Text = f"({x_val:.2f},{y_val:.2f})"

does not work and generates an exception. There are also other properties that generate exceptions on a data label. For example, DataLabels.Position works but DataLabel.Position does not.

Windows development Windows API - Win32
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.