Vba 使用LibreOffice中的宏将Impress幻灯片的背景更改为纯黑色
环顾四周,却找不到它。需要一个宏,以便我可以重复695次,对695个不同的文件,我有。文档有点不舒服,或者我很不走运 我可以在Microsoft VBA中执行以下操作:Vba 使用LibreOffice中的宏将Impress幻灯片的背景更改为纯黑色,vba,libreoffice,libreoffice-impress,Vba,Libreoffice,Libreoffice Impress,环顾四周,却找不到它。需要一个宏,以便我可以重复695次,对695个不同的文件,我有。文档有点不舒服,或者我很不走运 我可以在Microsoft VBA中执行以下操作: Sub VbaBlackies Dim oSl As Slide For Each oSl In ActivePresentation.Slides With oSl .FollowMasterBackground = msoFalse .Displ
Sub VbaBlackies
Dim oSl As Slide
For Each oSl In ActivePresentation.Slides
With oSl
.FollowMasterBackground = msoFalse
.DisplayMasterShapes = msoFalse
With .background
.Fill.ForeColor.RGB = RGB(0, 0, 0)
.Fill.BackColor.RGB = RGB(0, 0, 0)
End With
End With
Next oSl
End Sub
我在找LibreOffice BASIC中类似的东西。我可以这样开始编写代码:
Sub Main
Dim oDoc As Object
Dim oDPages As Object
Dim oDPage As Object
oDoc= ThisComponent
oDPages = oDoc.getDrawPAges()
For i=0 To oDPages.count()-1
oDPage = oDPages.getByIndex(i)
oDPage.Background = RGB(0,0,0) 'This does not work.
'I have no idea on how to access the object's properties and alter them.
Next i
End Sub
有什么想法吗?您需要的是的清单15.1,这是宏编程的基本参考
子背景
作为对象的Dim-oDoc
oDoc=该组件
将oDrawPages作为对象,将oDrawPages作为对象
oDrawPages=oDoc.getDrawPages()
oDrawPage=oDrawPages.getByIndex(0)
将背景视为对象
oBackground=oDoc.createInstance(“com.sun.star.drawing.Background”)
oBackground.FillColor=RGB(250,0,0)
oDrawPage.Background=oBackground
端接头
API文档位于。是!工作很有魅力,非常感谢你的回答 这是为我编写的最终代码:
Sub Main
Dim oDoc As Object
Dim oDPages As Object
Dim oDPage As Object
oDoc = ThisComponent
oDPages = oDoc.getDrawPAges()
For i=0 To oDPages.count()-1
oDPage = oDPages.getByIndex(i)
Dim oBackground As Object
oBackground = oDoc.createInstance("com.sun.star.drawing.Background")
oBackground.FillColor = RGB(0,0,0)
oDPage.Background = oBackground
Next i
End Sub
记录正在手动执行的更改的宏。这可能会为您提供所需的代码。尝试了此操作,但Impress不会录制宏。录制了一个宏,该宏在Calc中执行类似操作,更改单元格的背景颜色。给了我一些提示,但在获取幻灯片对象的“帧”参照时遇到困难。