Difference between revisions of "API/Samples/StarBasic/Impress/Insert a Chart"

From Apache OpenOffice Wiki
< API‎ | Samples‎ | StarBasic
Jump to: navigation, search
(Compressed the summary)
Line 1: Line 1:
 
{|
 
{|
| Snippet:              || InsertChart.BAS
+
| Description:          || Create a new [[Chart2| Chart]] object on a slide of a presentation or the page of a draw document.
|+
+
| Description:          || Create a new [[Chart2| Chart]] object on a slide of a presentation.
+
 
|+
 
|+
 
| Programming Language: || StarBasic
 
| Programming Language: || StarBasic
 
|+
 
|+
 
| Author:              || [[User:bm@openoffice.org| Björn Milcke]], 2007
 
| Author:              || [[User:bm@openoffice.org| Björn Milcke]], 2007
|+
 
| License:              || Public Domain
 
 
|}
 
|}
  

Revision as of 12:04, 27 August 2007

Description: Create a new Chart object on a slide of a presentation or the page of a draw document.
Programming Language: StarBasic
Author: Björn Milcke, 2007

[starbasic] Sub Main

   Set oPage = ThisComponent.getDrawPages().getByIndex(0)
   Set oOLEShape = ThisComponent.createInstance( "com.sun.star.drawing.OLE2Shape" )

   ' important: first add the shape
   oPage.add( oOLEShape )

   ' make the OLE object a chart
   oOLEShape.CLSID = "12dcae26-281f-416f-a234-c3086127382e"

   Set oChartModel = oOLEShape.Model
   If Not IsNull( oChartModel ) Then
       oChartModel.HasMainTitle = True
       oChartModel.Title.String = "Created via UNO API"
   EndIf

End Sub

Personal tools