Thank you, Fernand!
document = desktop.loadComponentFromURL("private:factory/swriter", "_blank", 0, ())
here you do not use any property value for opening "()"
Correct in this line, and the next few lines of code are:
>>> from com.sun.star.beans import PropertyValue
>>> propVal = PropertyValue()
>>> propVal.Name = "URL" # or "FileName"?
>>> propVal.Value = "file:///path/to/document.odt"
>>> document.load( (propVal,) )
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
__main__.DoubleInitializationException
I have also tried to pass a property list directly to the call above,
but that just opened an empty Writer document:
>>> document = desktop.loadComponentFromURL("private:factory/swriter", "_blank", 0, (propVal,))
Perhaps "URL" or "FileName" are not the correct properties to open a
file?
your solution to open a writer doc is the "filter" property
there are other available like "Hiden" ect..
Yes, all documented here:
https://wiki.openoffice.org/wiki/Documentation/DevGuide/OfficeDev/Handling_Documents#MediaDescriptor
dim oProps(0) as new com.sun.star.beans.PropertyValue
oProps2(1).Name = "FilterName"
oProps2(1).Value = "HTML (StarWriter)"
document = desktop.loadComponentFromURL("private:factory/swriter", "_blank", 0, oProps())
Hope it helps
Fernand
In this your example, how do you pass the actual document file name?
Privacy Policy |
Impressum (Legal Info) |
Copyright information: Unless otherwise specified, all text and images
on this website are licensed under the
Creative Commons Attribution-Share Alike 3.0 License.
This does not include the source code of LibreOffice, which is
licensed under the Mozilla Public License (
MPLv2).
"LibreOffice" and "The Document Foundation" are
registered trademarks of their corresponding registered owners or are
in actual use as trademarks in one or more countries. Their respective
logos and icons are also subject to international copyright laws. Use
thereof is explained in our
trademark policy.