Hello,
I was trying to figure out how to insert Charts/Formulae/Other OLE Objects into Writer programmatically, and I've figured out till now the service to use is css::text::TextEmbeddedObject. Now here I see that a certain property namely 'string CLSID' determines exactly what gets inserted into it's base frame at the cursor. Now my question is how exactly is this CLSID of different objects determined? I couldn't find any documentation listing these separately for each type. Also, am I on the right track? How to go about this type of insertion? Preferably in C++/Java.
Thanks in advance.
[Solved] Inserting OLE Objects (Charts/Formulae/etc)
[Solved] Inserting OLE Objects (Charts/Formulae/etc)
Last edited by SNM90 on Sun May 12, 2013 6:00 am, edited 2 times in total.
OpenOffice 3.1 on Windows Vista
(Libreoffice 4.0.0 on Windows 7)
(Libreoffice 4.0.0 on Windows 7)
Re: Inserting OLE Objects (Charts/Formulae/etc)
*Bump*
OpenOffice 3.1 on Windows Vista
(Libreoffice 4.0.0 on Windows 7)
(Libreoffice 4.0.0 on Windows 7)
Re: Inserting OLE Objects (Charts/Formulae/etc)
I think this is handled by the included Microsoft libraries.
http://msdn.microsoft.com/en-us/library ... 85%29.aspx
http://www.fileresearchcenter.com/showg ... term=CLSID
http://msdn.microsoft.com/en-us/library ... 85%29.aspx
http://www.fileresearchcenter.com/showg ... term=CLSID
Apache OpenOffice 4.1.15 on Xubuntu 22.04.4 LTS
Re: Inserting OLE Objects (Charts/Formulae/etc)
Hmm... in any case, I guess it's a standard. So for Charts/Formula, I'm now using the same one as mentioned in other codes I see on the forums.
Now I face another problem, I'm able to see charts and formulas as OLE objects after my program gets executed, but for formulas particularly, I'm not able to get how to insert the formula inside that formula box programmatically (Java/C++). OOBasic codes have not helped me at all, and I can't find anything on this in Java or C++. A little help on this?
To compress my problem: Need help in inserting formulas inside the formula box I got through a program. My current program to display it is like:
Also, how to I get to open the Formula element window automatically on running?
Now I face another problem, I'm able to see charts and formulas as OLE objects after my program gets executed, but for formulas particularly, I'm not able to get how to insert the formula inside that formula box programmatically (Java/C++). OOBasic codes have not helped me at all, and I can't find anything on this in Java or C++. A little help on this?
To compress my problem: Need help in inserting formulas inside the formula box I got through a program. My current program to display it is like:
Code: Select all
Any clsid;
clsid <<= OUString::createFromAscii("078b7aba-54fc-457f-8551-6147e776a997");
xPropSet->setPropertyValue("CLSID", clsid);
xText->insertTextContent(xTextRange, xTextContent, false);
OpenOffice 3.1 on Windows Vista
(Libreoffice 4.0.0 on Windows 7)
(Libreoffice 4.0.0 on Windows 7)
Re: Inserting OLE Objects (Charts/Formulae/etc)
Somthing like this in C++:
Code: Select all
// insert Formula
Reference< XInterface > xTextEmbedded(
xMsf->createInstance( A2S( "com.sun.star.text.TextEmbeddedObject" ) ), UNO_SET_THROW );
Reference< XPropertySet > xPropSet( xTextEmbedded, UNO_QUERY_THROW );
xPropSet->setPropertyValue( A2S( "CLSID" ), makeAny( A2S( "078B7ABA-54FC-457F-8551-6147e776a997" ) ) );
Reference< XTextContent > xTextContent( xTextEmbedded, UNO_QUERY_THROW );
xText->insertTextContent( xTextRange, xTextContent, sal_False );
Reference< XEmbeddedObjectSupplier2 > xEmbeddedSupp( xTextEmbedded, UNO_QUERY_THROW );
Reference< XComponent > xEmbeddedComp( xEmbeddedSupp->getEmbeddedObject(), UNO_SET_THROW );
Reference< XPropertySet > xFormulaPropSet( xEmbeddedComp, UNO_QUERY_THROW );
xFormulaPropSet->setPropertyValue( A2S( "Formula" ), makeAny( A2S( "x + y" ) ) );
// edit Formula inserted
Reference< XEmbeddedObject > xEmbeddedObject(
xEmbeddedSupp->getExtendedControlOverEmbeddedObject(), UNO_QUERY_THROW );
xEmbeddedObject->doVerb( -1 ); // hard to know without looking on its menu label?
What's wrong with it from converting Basic code to C++ or Java?OOBasic codes have not helped me at all
Please, edit this thread's initial post and add "[Solved]" to the subject line if your problem has been solved.
Apache OpenOffice 4-dev on Xubuntu 14.04
Apache OpenOffice 4-dev on Xubuntu 14.04
Re: Inserting OLE Objects (Charts/Formulae/etc)
Oh damn! I wasn't using Embedded Object Supplier interface! :O Just totally missed it. Was trying to directly access the formula properties. From BASIC, it isn't clear as they directly write obj.CLSID = something and then obj.EmbeddedObject.Formula = something. The latter confused me. Sorry if this question was dumb!
OpenOffice 3.1 on Windows Vista
(Libreoffice 4.0.0 on Windows 7)
(Libreoffice 4.0.0 on Windows 7)