swriter with chart

Regina Henschel rb.henschel at t-online.de
Thu Sep 22 15:29:37 UTC 2016


Hi,

Alain ANTOCI schrieb:
> Hi,
>
>
> I use Delphi to develop an application which needs to work with MS
> office and LibreOffice. I've a question about Chart in Libreoffice, I
> need to access a chart in a libreoffice document to change values. I try
> to use GetCharts then getbyname or getbyindex like in calc but it
> doesn't seem to work is there anything to do, i've seen some posts
> talking about writer and ole object it doesn't seem to be support yet.
>
>
> Can you confirm to me if it is possible or not, or is it schedule in a
> future version please ?

Charts are OLE objects. Use the Basic macro below (you might need to fix 
unwanted line breaks) and the Basic IDE to examine the Chart-object. In 
the column Type in the watch-window and in the variable 
"SupportedServiceNames" you will find the hints, which part of the API 
is relevant. The variable "Types" contains information about the 
supported methods. Or use Xray (in Basic) to examine the objects to 
learn the supported methods.

You can start examine the objects, if you set a break point at the line 
"msgbox" inside the for-loop and add the objects to the Watch-window.

Kind regards
Regina

sub ExamineEmbeddedObjects
dim oCurrentController as variant: oCurrentController = 
ThisComponent.getCurrentController()
dim oDoc as variant: oDoc=ThisComponent
if 
not(oCurrentController.supportsService("com.sun.star.text.TextDocumentView")) 
then
	msgbox("Macro works only in text documents.")
	exit sub
end if
dim oModelTextDocument as variant: oModelTextDocument = 
oCurrentController.Model
dim oEmbeddedObjects as variant: oEmbeddedObjects = 
oModelTextDocument.EmbeddedObjects
dim nIndex as long
dim nEndIndex as long: nEndIndex = oEmbeddedObjects.Count-1
dim oEmbeddedObject as variant: rem like green handle status
dim oModel as variant: rem like edit status
dim oXCOEO as variant: rem oExtendedControlOverEmbeddedObject
for nIndex=0 to nEndIndex
	oEmbeddedObject = oEmbeddedObjects.getByIndex(nIndex)
	oModel = oEmbeddedObject.Model: rem I'm not sure, whether it might be empty
	if Not(isEmpty(oModel)) then
	Rem Do something with the object
     Rem Use xray or Basic IDE to examine the object
         msgbox("I am: " & oEmbeddedObject.StreamName)
		oXCOEO = oEmbeddedObject.ExtendedControlOverEmbeddedObject
		oXCOEO.update()			
	end if
next nIndex
end sub



More information about the LibreOffice mailing list