Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

I need help exporting a chart

Hi all,

This does export something. A down arrow, which is not on the chart, but does occur on the table to its left.

This chart in question appears on the second sheet (starting counting from 1).

What am I doing wrong?

Many thanks, -T

Sub ExportChart( ChartName As String )
   Dim MsgRtn     as Integer
   Dim shape
   Dim gef
   Dim args1(1) as new com.sun.star.beans.PropertyValue
   Dim args2(1) as new com.sun.star.beans.PropertyValue

   dim document   as object
   dim dispatcher as object

   ' change to the Weight & Balance sheet
   document   = ThisComponent.CurrentController.Frame
   dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
   args1(0).Name = "Nr"
   args1(0).Value = 2
   dispatcher.executeDispatch(document, ".uno:JumpToTable", "", 0, args1())

   shape = ThisComponent.getSheets().getByIndex(0).getDrawPage().getByIndex(0)
   args2(0).Name = "URL"
   ' args2(0).Value = "file:///home/asuka/Downloads/foo.png"
   args2(0).Value = "file:///" + ChartName
   args2(0).Value = Replace( args2(0).Value, "\", "/" )
  '  MsgRtn = MsgBox( args2(0).Value, 0, "ExportChart" )

   args2(1).Name = "MimeType"
   args2(1).Value = "image/png"

   gef = CreateUnoService("com.sun.star.drawing.GraphicExportFilter")
   gef.setSourceDocument(shape)
   gef.filter(args2)
End Sub

I need help exporting a chart

Hi all,

This does export something. A down arrow, which is not on the chart, but does occur on the table to its left.

This chart in question appears on the second sheet (starting counting from 1).

What am I doing wrong?

Many thanks, -T

Sub ExportChart( ChartName As String )
   Dim MsgRtn     as Integer
   Dim shape
   Dim gef
   Dim args1(1) as new com.sun.star.beans.PropertyValue
   Dim args2(1) as new com.sun.star.beans.PropertyValue

   dim document   as object
   dim dispatcher as object

   ' change to the Weight & Balance sheet
   document   = ThisComponent.CurrentController.Frame
   dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
   args1(0).Name = "Nr"
   args1(0).Value = 2
   dispatcher.executeDispatch(document, ".uno:JumpToTable", "", 0, args1())

   shape = ThisComponent.getSheets().getByIndex(0).getDrawPage().getByIndex(0)
   args2(0).Name = "URL"
   ' args2(0).Value = "file:///home/asuka/Downloads/foo.png"
   args2(0).Value = "file:///" + ChartName
   args2(0).Value = Replace( args2(0).Value, "\", "/" )
  '  MsgRtn = MsgBox( args2(0).Value, 0, "ExportChart" )

   args2(1).Name = "MimeType"
   args2(1).Value = "image/png"

   gef = CreateUnoService("com.sun.star.drawing.GraphicExportFilter")
   gef.setSourceDocument(shape)
   gef.filter(args2)
End Sub