Date: prev next · Thread: first prev next last
2015 Archives by date, by thread · List index


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: users+unsubscribe@global.libreoffice.org
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

Context


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.