Piet,
first i alayw provide some information when storing not a empty array a
you did
Thiscomponent.storeToURL( ConvertToURL(sfile), Array(
MakePropertyValue("FilterName", "writer8", "ReadOnly", "False" ))
and i allways do convertToURL(myURL) to been sure it's a correct URL
(your URL seems corrrect)
Did you played around with
"storeAsURL" and "storeAToURL"
I do the folowing check
if fileexists(ConvertToURL(sfile)) then
Thiscomponent.storeToURL( ConvertToURL(sfile), Array(
MakePropertyValue("FilterName", "writer8", "ReadOnly", "False"))
' bIsNewDoc = False
else
Thiscomponent.storeAsURL( ConvertToURL(sfile), Array(
MakePropertyValue("FilterName", "writer8", "ReadOnly", "False"))
' bIsNewDoc = true
end if
Hope it helps
Fernand
On 26/03/2015 11:38, Piet van Oostrum wrote:
I am currently experimenting with programming LibreOffice through Python/UNO.
One thing I tried is to create a document, not with the loadComponentFromURL call from the desktop,
but the route via the XLoadable interface,
After setting up the connection, getting the context, servicemanager, desktop, and XSCRIPTCONTEXT,
the following works:
calcdoc = smgr.createInstanceWithContext("com.sun.star.sheet.SpreadsheetDocument", context)
calcdoc.initNew() # or calcdoc.load(....)
sheets = calcdoc.getSheets()
sheet1 = sheets.getByName("Sheet1")
cell = sheet1.getCellByPosition(0,0)
cell.String = "Hello World"
calcdoc.storeAsURL("file:///Users/piet/TEST/LibreOffice/testcalc.ods", ())
calcdoc.close(True)
Of course I could have used
calcdoc = desktop.loadComponentFromURL("private:factory/scalc", "_blank", 0, ());
(or with a Hidden=True property)
but I just wanted to experiment with the createInstance version.
Now the above example works perfectly. It creates the spreadsheet, and nothing is shown on the
screen.
Now when I do this with a Writer document:
textdoc = smgr.createInstanceWithContext("com.sun.star.text.TextDocument", context)
LibreOffice crashes with a segmentation fault. It looks like a null pointer is dereferenced or
stored into. It seems to be in the event loop. So maybe there is some pointer not properly
initialized.
Here is part of the crash report (Mac OS X 10.10.2). This happens both with LibreOffice 4.4.1.2
from the installer package and a self-compiled master version.
Process: soffice [25385]
Path: /Users/USER/Downloads/*/LibreOfficeDev.app/Contents/MacOS/soffice
Identifier: org.libreoffice.script
Version: 4.5.0 (0)
Code Type: X86-64 (Native)
Parent Process: bash [71305]
Responsible: Terminal [71161]
User ID: 501
Date/Time: 2015-03-26 11:23:20.020 +0100
OS Version: Mac OS X 10.10.2 (14C1510)
Report Version: 11
Anonymous UUID: 0AEBB0CD-ADAB-A830-FE6A-DB114A5C4135
Sleep/Wake UUID: 6AC2711A-D840-4BA5-9661-4545A1C4ABDB
Time Awake Since Boot: 900000 seconds
Time Since Wake: 8400 seconds
Crashed Thread: 10
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x0000000000000000
VM Regions Near 0:
-->
__TEXT 000000010feff000-000000010ff00000 [ 4K] r-x/rwx SM=COW
/Users/USER/Downloads/*/LibreOfficeDev.app/Contents/MacOS/soffice
Thread 0:: Dispatch queue: com.apple.main-thread
0 libsystem_kernel.dylib 0x00007fff93f494de mach_msg_trap + 10
1 libsystem_kernel.dylib 0x00007fff93f4864f mach_msg + 55
2 com.apple.CoreFoundation 0x00007fff92a4ab34 __CFRunLoopServiceMachPort + 212
3 com.apple.CoreFoundation 0x00007fff92a49ffb __CFRunLoopRun + 1371
4 com.apple.CoreFoundation 0x00007fff92a49858 CFRunLoopRunSpecific + 296
5 com.apple.HIToolbox 0x00007fff92df2aef RunCurrentEventLoopInMode + 235
6 com.apple.HIToolbox 0x00007fff92df286a ReceiveNextEventCommon + 431
7 com.apple.HIToolbox 0x00007fff92df26ab
_BlockUntilNextEventMatchingListInModeWithFilter + 71
8 com.apple.AppKit 0x00007fff87bbcf81 _DPSNextEvent + 964
9 com.apple.AppKit 0x00007fff87bbc730 -[NSApplication
nextEventMatchingMask:untilDate:inMode:dequeue:] + 194
10 libvcllo.dylib 0x0000000111f80ee6 AquaSalInstance::Yield(bool, bool) + 1094
11 libvcllo.dylib 0x0000000111f0e0ca Application::Yield() + 74
12 libvcllo.dylib 0x0000000111f0e065 Application::Execute() + 37
13 libsofficeapp.dylib 0x000000010ff7ea75 desktop::Desktop::Main() + 7573
14 libvcllo.dylib 0x0000000111f11812 ImplSVMain() + 50
15 libvcllo.dylib 0x0000000111f808b4
AquaSalInstance::handleAppDefinedEvent(NSEvent*) + 84
16 libvcllo.dylib 0x0000000111fb65b1 -[VCL_NSApplication sendEvent:] + 321
17 com.apple.AppKit 0x00007fff87bb0608 -[NSApplication run] + 711
18 com.apple.AppKit 0x00007fff87b9ba14 NSApplicationMain + 1832
19 libvcllo.dylib 0x0000000111f7fc09 ImplSVMainHook(int*) + 329
20 libvcllo.dylib 0x0000000111f123fa SVMain() + 26
21 libsofficeapp.dylib 0x000000010ffa9bc0 soffice_main + 224
22 org.libreoffice.script 0x000000010fefff20 main + 16
23 libdyld.dylib 0x00007fff86dc25c9 start + 1
Context
- LibreOffice HEAD won't run (continued)
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.