1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
|
dim oDoc As Object
Dim Rect As New com.sun.star.awt.Rectangle
Dim Source(0) As New com.sun.star.table.CellRangeAddress
Dim oCharts As Object , oChart As Object
oDoc = ThisComponent
rem Graphique en Feuille 2 : A adapter au final
oCharts = oDoc.sheets(1).Charts
Rect.X = 1000 ' Horizontal
Rect.Y = 500 ' Vertical
Rect.Width = 14000 ' Largeur
Rect.Height = 8000 ' Haureur
source(0).Sheet = 0
source(0).StartColumn = 2
source(0).StartRow = 0
source(0).EndColumn = 3
source(0).EndRow = 6
oChart = oCharts.getByName("MonGraphique").EmbeddedObject
With oChart
.Diagram = oChart.createInstance("com.sun.star.chart.PieDiagram")
.DataSourceLabelsInFirstColumn = True
.DataSourceLabelsInFirstRow = False
rem .Diagram.YAxis.CharHeight = 4
rem .Diagram.XAxis.CharHeight = 4
'Attribue un titre au graphique puis un couleur à la chaîne de caractères
.Title.String = "Répartition"
.Title.CharColor = RGB(200,0,0)
End With
oDoc.Sheets(0).getCellByPosition(7,2).String = "MonGraphique" |
Partager