我正在尝试将 TabStop 导入我的 Python 脚本以创建 openoffice 文档。只有我不断收到此错误:
Traceback (most recent call last):
File "C:\Users\Sander\Desktop\macroTest.py", line 10, in <module>
from com.sun.star.style import TabStop
ImportError: No module named com.sun.star.style
这是我用来创建文档的代码的一部分:
from win32com.client import Dispatch as Dispatch
svm = Dispatch("com.sun.star.ServiceManager")
coreflect = svm.createInstance("com.sun.star.reflection.CoreReflection")
desktop = svm.createInstance("com.sun.star.frame.Desktop")
doc = desktop.loadComponentFromURL("private:factory/swriter", "_blank",0, [])
default = doc.StyleFamilies.getByName("PageStyles").getByName("Default")
txt = doc.getText()
cur = txt.createTextCursor()
出错的那一行:
from com.sun.star.style import TabStop
有人知道如何解决此导入问题吗?
提前致谢!