I am wanting to insert an image into a LibreOffice Draw document using Basic. I create a Draw document and then I add a page to the document and then rename the pages. I want ti insert an image into Page1 and then add another Image to Page2. I have the pages created as I want but I am unable to insert the image into the page. Below is my code
sub InsertImage()
Dim Doc As Object
Dim Page1 as Object
Dim Page2 as Object
Dim DocPath1 as String
DocPath1 = ConvertToURL("MyImage1.jpg")
Dim DocPath2 as String
DocPath2 = ConvertToURL("MyImage2.jpg")
Dim noArgs() 'An empty array for the arguments
Dim sURL As String
sURL = "private:factory/sdraw"
Doc = StarDesktop.LoadComponentFromUrl(sURL, "_blank", 0, noArgs())
Page1 = Doc.DrawPages(0)
Page1.Name = "Image1"
Page2 = Doc.Drawpages.insertNewByIndex(2)
Page2.Name = "Image2"
' Page1.FillStyle = com.sun.star.drawing.FillStyle.BITMAP
' Page1.FillBitmapURL = DocPath1
End sub
I have been reading Andrew Pitonyak's book but unable to find a source for what I am trying to do. FillStyle breaks the code.