Reputation: 53
I'm trying to import a TabStop into my Python script to create an openoffice document. Only i keep getting this error:
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
This is a part of the code i use to create a document:
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()
The line it goes wrong:
from com.sun.star.style import TabStop
Anybody knows how to fix this import?
Thanks in advance!
Upvotes: 0
Views: 532
Reputation: 53
I have fixed this problem. I used a installed version of Python 2.7. I found a python.exe in the openoffice folder. When i use that executable the imports work.
Upvotes: 1