I need to left-align text in a Visio shape programatically using Python 2.7 and the Pywin32 package.
I am able to use the VerticalAlign argument without problem; however, the HorizAlign argument causes the pywin32 package to throw the error below.
scheduleShape.CellsU("HorizAlign").FormulaU = '0'
File "<COMObject Drop>", line 2, in CellsU
pywintypes.com_error: (-2147352567, 'Exception occurred.', (0, u'Drawing10 -
Visio Professional', u'\n\nUnexpected end of file.', None, 0, -2032466967), None)
Because cell name is not "HorzAlign" but "Para.HorzAlign". Check the docs at the link, "cell name". Should work:
scheduleShape.CellsU("Para.HorzAlign").FormulaU = '0'