Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Got it figured out. It is working beautifully. Thank you for all the help!

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 and address the weights and balance table

   shape = ThisComponent.getSheets().getByIndex(1).getDrawPage().getByIndex("WeightAndBalanceChart")
   '                                                            |                                              ^---  Name of Chart
   '                                                            ^--- 0 = sheet zero, 1= sheet1 etc, regardless if you have renamed them
   '
   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