I'm working on a project with a group and we've hit a stumbling block dealing with OLE objects. We've done a lot of research on this subject and can't find a way to insert an existing OLE object into a Shape using either macros or Java.
We know how to create an ole2shape object but the problem is that the model and embeddedobject properties are always set to read only. A user can insert an embedded object via the GUI so I feel like this has to be possible in some form or another. However, I'm worried that it may not be possible to do so programmatically since the API may not allow it. We know how to create an embedded object but can't figure out how to get that newly created embedded object into a shape object. Do we need to start with a different object that allows us to insert an embedded object and then convert it to a shape? Based on the LibreOffice source code it seems like that would be one way it works. Does anyone have any ideas on how to do this?
We've looked through the LibreOffice source code but probably need to see the Java API source code as well. Unfortunately I can't seem to find the Java API source code. Does anyone know if that's available somewhere?
Inserting an existing OLE object into a Shape
Inserting an existing OLE object into a Shape
LibreOffice 5.3.7 on Windows 7
Re: inserting an existing OLE object into a Shape
Please upload an ODF type sample file here.A user can insert an embedded object via the GUI
Tibor Kovacs, Hungary; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
-
- Volunteer
- Posts: 1547
- Joined: Wed Jun 24, 2015 12:56 am
- Location: Colorado, USA
Re: inserting an existing OLE object into a Shape
Have you looked at Andrew Davidson's web site
http://fivedots.coe.psu.ac.th/~ad/jlop/
In addition to his book “Java LibreOffice Programming” he also gives his email address.
http://fivedots.coe.psu.ac.th/~ad/jlop/
In addition to his book “Java LibreOffice Programming” he also gives his email address.
If your problem has been solved, please edit this topic's initial post and add "[Solved]" to the beginning of the subject line
Apache OpenOffice 4.1.14 & LibreOffice 7.6.2.1 (x86_64) - Windows 10 Professional- Windows 11
Apache OpenOffice 4.1.14 & LibreOffice 7.6.2.1 (x86_64) - Windows 10 Professional- Windows 11
-
- Posts: 145
- Joined: Mon Jun 13, 2016 10:50 am
Re: Inserting an existing OLE object into a Shape
Hello,
Here is an example in basic, that inserts an empty Calc spreadsheet object into a writer document :
CLSID is unique for each OLE object type, but I can't find in the documentation a complete list. Just create an OLE object with the gui and inspect it to find the corresponding CLSID...
Regards.
Here is an example in basic, that inserts an empty Calc spreadsheet object into a writer document :
Code: Select all
doc = thiscomponent
embed = doc.createInstance("com.sun.star.text.TextEmbeddedObject")
embed.CLSID = "47BBB4CB-CE4C-4E80-a591-42d9ae74950f"
dim size as new com.sun.star.awt.Size
size.Height = 2500
size.Width = 10000
embed.setSize(size)
T = doc.Text
T.insertTextContent(T.End, embed, False)
Regards.
AOOo 4.1.2 on Win7 | LibreOffice on various Linux systems