Seite 1 von 1

Makro - Kreise zeichnen

Verfasst: So, 15.05.2005 12:08
von mike6
Hallo,

ich suche für folgendes Makro einen Lösungsansatz:

• ich möchte ca. 20 Kreise mit jeweils einer anderen
Zahl erzeugen.
1 - 2- .......10-11-12 ......

Die Kreise sollen die gleiche Größe haben.


Wer hat einen Lösungsansatz?
OpenOffice - Calc 2.0

mfg
mike6

Verfasst: Di, 28.06.2005 11:43
von zap
Hi mike,
das hier funktioniert bei mir:

Code: Alles auswählen

' helper 
function machPoint(byval x as long,byval y as long) as com.sun.star.awt.Point
  Dim oPoint
  oPoint = createUnoStruct ("com.sun.star.awt.Point")
  oPoint.X = x
  oPoint.Y = y
  machPoint = oPoint
end function

function machSize(byval x as long,byval y as long) as com.sun.star.awt.Size
  Dim oSize
  oSize = createUnoStruct ("com.sun.star.awt.Size")
  oSize.Width = x
  oSize.Height = y
  machSize = oSize
End Function

Sub Kreise
  oDokument = ThisComponent
  oSeite = oDokument.drawpages(0)

  for i = 1 to 20
    oKreis = ThisComponent.createInstance ("com.sun.star.drawing.EllipseShape")
    oSeite.add(oKreis)
  ' Angaben sind in 0,01 mm
    oKreis.setPosition(machPoint(1500*i,1000))
    oKreis.setSize(machSize(1000,1000)) ' 1cm x 1cm
    oKreis.setString(CStr(i))
  next i
End Sub
Zap