Jens Tröger schreef op 15/03/2015 om 14:02:
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?
just replace

"private:factory/swriter" with the URL of your document , be sure its a URL bij 
converting it

using a OO native function: example converttoURL("c:\myfile.odt")

hope it helps

Fernand


Cheers,
Jens



--
To unsubscribe e-mail to: [email protected]
Problems? http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette
List archive: http://listarchives.libreoffice.org/global/users/
All messages sent to this list will be publicly archived and cannot be deleted

Reply via email to