sub joonistaJoon(x1, y1, laius, korgus, doc) dim punkt as new com.sun.star.awt.Point dim suurus as new com.sun.star.awt.Size dim joon as Object joon = Doc.createInstance("com.sun.star.drawing.LineShape") punkt.x=x1 punkt.y=y1 suurus.width=laius suurus.height=korgus joon.position=punkt joon.size=suurus doc.drawPages(0).add(joon) end sub sub joonistaJuku(vasakult, ylalt, _ kehapikkus, pearaadius) Doc = StarDesktop.CurrentComponent 'leht = Doc.drawPages(0) joonistaJoon(vasakult+pearaadius, ylalt, 0, kehapikkus, doc) joonistaJoon(vasakult+pearaadius, ylalt+kehapikkus, pearaadius, kehapikkus, doc) joonistaJoon(vasakult+pearaadius, ylalt+kehapikkus, -pearaadius, kehapikkus, doc) joonistaJoon(vasakult+pearaadius, ylalt+kehapikkus/4, pearaadius, kehapikkus, doc) joonistaJoon(vasakult+pearaadius, ylalt+kehapikkus/4, -pearaadius, kehapikkus, doc) end sub sub juku1() joonistaJuku 200, 300, 1000, 200 end sub sub juku2() leht=StarDesktop.CurrentComponent.sheets(0) pikkus=leht.getCellByPosition(3, 1).value laius=leht.getCellByPosition(4, 1).value joonistaJuku(200, 300, pikkus*10, laius*5) end sub sub juku3() leht=StarDesktop.CurrentComponent.sheets(0) rida=1 while(len(leht.getCellByPosition(3, rida).string)>0) joonistaJuku(rida*1000, 500, _ leht.getCellByPosition(3, rida).value*10, _ leht.getCellByPosition(4, rida).value*5) rida=rida+1 wend end sub sub joonistus1 Dim Doc As Object Dim Page As Object Dim LineShape As Object Dim Point As New com.sun.star.awt.Point Dim Size As New com.sun.star.awt.Size Doc = StarDesktop.CurrentComponent Point.x = 1000 Point.y = 1000 leht=Doc.sheets(0) Size.Width = leht.getCellByPosition(0, 1).value msgbox "Laius: " & size.width Size.Height = 0 Page = Doc.drawPages(0) LineShape = Doc.createInstance("com.sun.star.drawing.LineShape") LineShape.Size = Size LineShape.Position = Point Page.add(LineShape) end sub sub joonis1 Dim Doc As Object Dim Page As Object Dim RectangleShape As Object Dim Point As New com.sun.star.awt.Point Dim Size As New com.sun.star.awt.Size Doc = StarDesktop.CurrentComponent Page = Doc.drawPages(0) Point.x = 1000 Point.y = 1000 Size.Width = 10000 Size.Height = 5000 RectangleShape = Doc.createInstance("com.sun.star.drawing.RectangleShape") RectangleShape.Size = Size RectangleShape.Position = Point Page.add(RectangleShape) end sub