
[Java] Text in Impress einfügen
Moderator: Moderatoren
Re: [Java] Text in Impress einfügen
Im Impress musste erst ein TextShape erstellen und dort den Text reinschreiben .... bzw in den Propertys deine Formatierung angeben 

Re: [Java] Text in Impress einfügen
Wer Google benutzt hat die macht
Stichpunkt "uno TextShape".
Gefunden:
Dies ist nun nicht ganz dein Dialekt ^^ .. doch von Makros sollte man sich das herleiten können 

Gefunden:
Code: Alles auswählen
Sub Main
Dim oShape1 As Object
Dim oShape2 As Object
Dim oShape3 As Object
oShape1 = MakeTextShape(ThisComponent, MakePoint_Utils(7*1000, 5*1000), MakeSize_Utils(5*1000, 1*1000))
ThisComponent.getCurrentController().getCurrentPage().add( oShape1 )
oShape1.setString("Foo")
oShape2 = MakeTextShape(ThisComponent, MakePoint_Utils(7*1000, 7*1000), MakeSize_Utils(5*1000, 1*1000))
ThisComponent.getCurrentController().getCurrentPage().add( oShape2 )
oShape2.setString("Foo2")
oShape3 = MakeTextShape(ThisComponent, MakePoint_Utils(7*1000, 9*1000), MakeSize_Utils(5*1000, 1*1000))
ThisComponent.getCurrentController().getCurrentPage().add( oShape3 )
ThisComponent.getCurrentController().getCurrentPage().remove( oShape3 )
End Sub
Function MakeTextShape( oDoc As Object,_
Optional position As com.sun.star.awt.Point,_
Optional size As com.sun.star.awt.Size ) As com.sun.star.drawing.TextShape
oShape = oDoc.createInstance( "com.sun.star.drawing.TextShape" )
If Not IsMissing( position ) Then
oShape.Position = position
EndIf
If Not IsMissing( size ) Then
oShape.Size = size
EndIf
MakeTextShape = oShape
End Function
Function MakePoint_Utils(ByVal x As Long, ByVal y As Long) As com.sun.star.awt.Point
Dim oPoint As Object
oPoint = CreateUnoStruct("com.sun.star.awt.Point")
oPoint.X = x
oPoint.Y = y
MakePoint_Utils = oPoint
End Function
Function MakeSize_Utils(ByVal width As Long, ByVal height As Long) As com.sun.star.awt.Size
Dim oSize As Object
oSize = CreateUnoStruct("com.sun.star.awt.Size")
oSize.Width = width
oSize.Height = height
MakeSize_Utils = oSize
End Function
