I use win32com to work with Microsoft documents and I want to use shape to distinguish between normal text fields and artistic text fields. When I usedoc.Shapes.Item(1).texteffect, the doc is a Document Object, the following error was returned:
Cell In[46], line 1
----> 1 doc.Shapes.Item(1).TextEffect
File [d:\myproject\sanxue_gui\env_format\lib\site-packages\win32com\client\dynamic.py:628](file:///D:/myproject/sanxue_gui/env_format/lib/site-packages/win32com/client/dynamic.py:628), in CDispatch.__getattr__(self, attr)
624 debug_attr_print(
625 "Getting property Id 0x%x from OLE object" % retEntry.dispid
626 )
627 try:
--> 628 ret = self._oleobj_.Invoke(retEntry.dispid, 0, invoke_type, 1)
629 except pythoncom.com_error as details:
630 if details.hresult in ERRORS_BAD_CONTEXT:
631 # May be a method.
com_error: (-2147352567, '发生意外。', (0, None, None, None, 0, -2147467259), None)
pywin32 version 305
I use win32com to work with Microsoft documents and I want to use shape to distinguish between normal text fields and artistic text fields. When I use
doc.Shapes.Item(1).texteffect
, thedoc
is aDocument Object
, the following error was returned:发生意外
meansunexpected error