Cannot retrieve container for XShape in LibreOffice

24 views Asked by At

I'm struggling with some code using LibreOffice 7.1.0 on Windows 10 to append images from a folder into separate slides in Impress. I've been looking here and OpenOffice documentation. This call continuously fails (null): xMultiServiceFactory.createInstance("com.sun.star.drawing.BitmapTable"); and I cannot understand why? I tried using XMultiComponentFactory also, but no luck. Has it got something to do with Slide Layout, but despite being of blank type, I could drag-drop an image and it gets added in the slide. Unfortunately, full code is on restricted system, so I have this much only. Any hints on potential causes would be very helpful.

1

There are 1 answers

0
user2338150 On

It was simple issue: I needed to initialize xMultiServiceFactory with xComponent. I had earlier initialized it with xComponentContext.getServiceManager(). I realize again, this is why learning object model is very important. COM could get tricky unless, one knew what they were doing.