swriter with chart

classic Classic list List threaded Threaded
4 messages Options
Alain ANTOCI Alain ANTOCI
Reply | Threaded
Open this post in threaded view
|

swriter with chart

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 ?


Regards


ANTOCI Alain

ADF Informatique


_______________________________________________
LibreOffice mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/libreoffice
Regina Henschel Regina Henschel
Reply | Threaded
Open this post in threaded view
|

Re: swriter with chart

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

_______________________________________________
LibreOffice mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/libreoffice
Katarina Behrens Katarina Behrens
Reply | Threaded
Open this post in threaded view
|

Re: swriter with chart

Hello world,
 
> > I use Delphi to develop an application which needs to work with MS
> > office and LibreOffice. I've a question about Chart in Libreoffice,
...
> supported methods. Or use Xray (in Basic) to examine the objects to
> learn the supported methods.

Yay for XRay \o/ Get it from here: http://berma.pagesperso-orange.fr/index2.html

It's really an excellent tool for object introspection and learning about API,
esp. when you're a visual learner.
--

Katarina Behrens

Softwareentwicklerin LibreOffice
–––
CIB software GmbH
Geschäftsstelle Hamburg
Flachsland 10
22083 Hamburg
–––
T +49 (40) / 28 48 42 -235
F +49 (40) / 28 48 42 -100

[hidden email]
www.cib.de
–––
Sitz: München
Registergericht München, HRB 123286
Geschäftsführer: Dipl.-Ing. Ulrich Brandner
_______________________________________________
LibreOffice mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/libreoffice
Bjoern Michaelsen Bjoern Michaelsen
Reply | Threaded
Open this post in threaded view
|

Re: swriter with chart

Hi,

On Thu, Sep 22, 2016 at 10:57:18PM +0200, Katarina Behrens wrote:

> Hello world,
>  
> > > I use Delphi to develop an application which needs to work with MS
> > > office and LibreOffice. I've a question about Chart in Libreoffice,
> ...
> > supported methods. Or use Xray (in Basic) to examine the objects to
> > learn the supported methods.
>
> Yay for XRay \o/ Get it from here: http://berma.pagesperso-orange.fr/index2.html
>
> It's really an excellent tool for object introspection and learning about API,
> esp. when you're a visual learner.

Or you use the com.sun.star.script.theServiceDocumenter, which comes with
LibreOffice since 5.1, like so (StarBasic example):

  TheServiceDocumenter = GetDefaulftContext().getValueByName("/singletons/com.sun.star.util.theServiceDocumenter") # this should be simpler[1]
  TheServiceDocumenter.showServiceDocs(UnoThingThatYouWhatToKnowMoreAbout)
  TheServiceDocumenter.showInterfaceDocs(UnoThingThatYouWhatToKnowMoreAbout)

showServiceDocs shows you the service details about
UnoThingThatYouWhatToKnowMoreAbout by opening the relevant service page from
http://api.libreoffice.org/docs/idl/ref/index.html in your browser.
showInterfaceDocs shows you everything you can do with this service by opening
the links of all interfaces it implements in your browser. Not though for
something like "ThisComponent" in Writer this might be quite a lot.

So as you see, no need to install extensions to simply find out what an UNO service
is and what it provides in LibreOffice. ;)

More details at: https://www.youtube.com/watch?v=WBNG6bVZPzw

Best,

Bjoern


[1] see https://bugs.documentfoundation.org/show_bug.cgi?id=97447 
_______________________________________________
LibreOffice mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/libreoffice