简体   繁体   English

无法在 LibreOffice 中检索 XShape 的容器

[英]Cannot retrieve container for XShape in LibreOffice

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 .我正在努力使用LibreOffice 7.1.0上的Windows 10到 append 图像从文件夹到Impress中的单独幻灯片中的一些代码。 I've been looking here and OpenOffice documentation.我一直在看这里OpenOffice文档。 This call continuously fails (null) : xMultiServiceFactory.createInstance("com.sun.star.drawing.BitmapTable");此调用连续失败(null)xMultiServiceFactory.createInstance("com.sun.star.drawing.BitmapTable"); and I cannot understand why?我不明白为什么? I tried using XMultiComponentFactory also, but no luck.我也尝试使用XMultiComponentFactory ,但没有运气。 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.它是否与Slide Layout有关,但尽管是空白类型,但我可以拖放图像并将其添加到幻灯片中。 Unfortunately, full code is on restricted system, so I have this much only.不幸的是,完整的代码在受限系统上,所以我只有这么多。 Any hints on potential causes would be very helpful.任何关于潜在原因的提示都会非常有帮助。

It was simple issue: I needed to initialize xMultiServiceFactory with xComponent .这是一个简单的问题:我需要用xComponent xMultiServiceFactory I had earlier initialized it with xComponentContext.getServiceManager() .我之前使用xComponentContext.getServiceManager()对其进行了初始化。 I realize again, this is why learning object model is very important.我再次意识到,这就是为什么学习 object model 非常重要的原因。 COM could get tricky unless, one knew what they were doing. COM 可能会变得棘手,除非有人知道他们在做什么。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM