Calc: need macro ExportAsGraph help

Hi All,

When I Record macro and export a graph as a PNG, the recorder dutifully records except the export. Instead I get

rem dispatcher.executeDispatch(document, ".uno:ExportAsGraphic", "", 0, Array())

Removing the remark and it still does nothing.

Is the a best way to export a graph?

Many thanks,
-T

Hello,

Using Record macro will seldom give you the necessary code when performing more complex procedures as this.

There is a macro by hanya on this post → Re: Macro: Save Graphs as Images (many of them!). The macro works almost as is.

It is necessary to understand first that images (pictures, graphs, buttons, etc) are stored on the DrawPage. You need to be able to get at the specific item you want to export. Make sure you have given the chart a name and you can use this name in determining if the indexed object is the chart you want. You also need to specify the name of the saved image and also the place to save it in.

Thank you!