timxx / pywpsrpc

Python bindings for WPS Office RPC (for Linux)
MIT License
219 stars 44 forks source link

{AttributeError}Call 'get_DistanceFrom()' failed with 0x80010105 #46

Closed mjTree closed 2 years ago

mjTree commented 2 years ago

Describe the bug 在使用wps解析word文件时,通过Range类的Borders获取文本框与页面边缘距离时报错。 code: document.Sections.Item(1)[1].Headers.Item(1)[1].Range.Borders.DistanceFrom error: {AttributeError}Call 'get_DistanceFrom()' failed with 0x80010105

Expected behavior 应该通过设置wdBorderDistanceFromPageEdge获取文本框与页面距离。

Screenshots 20220308195346

Environment ubuntu20 pywpsrpc: pip, 2.3.1 wps: 11.1.0.10920_amd64

timxx commented 2 years ago

可以提供个样张么。。怎么制作的。。。

话说这个Item这个可以换个写法就没这么丑了:doc.Sections[1].Headers[1].Range.Borders.DistanceFrom

timxx commented 2 years ago
doc.Sections[1].Borders[1].LineStyle = wpsapi.wdLineStyleSingle
#doc.Sections[1].Headers[1].Range.Borders.DistanceFrom = wpsapi.wdBorderDistanceFromPageEdge
doc.Sections[1].Borders.DistanceFrom = wpsapi.wdBorderDistanceFromPageEdge

上面这种写法是可以的,从MSO官网抄的例子