我想使用 Basic 将图像插入到 LibreOffice Draw 文档中。我创建了一个 Draw 文档,然后在文档中添加了一个页面,然后重命名了这些页面。我想将图像插入 Page1,然后将另一个图像添加到 Page2。我根据需要创建了页面,但无法将图像插入页面。下面是我的代码
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
我一直在阅读 Andrew Pitonyak 的书,但无法找到我想要做的事情的来源。FillStyle 破坏了代码。