first way:
Code: Select all
Sub Main
oDoc = ThisComponent
oSheet = oDoc.getSheets().getByIndex( 1 )
oDrawPage = oSheet.getDrawPage()
cFile = "\\kamsslab-ir\R\source\st_ku_pet.jpg"
cUrl = ConvertToUrl( cFile )
oShape = MakeGraphicObjectShape( oDoc, MakePoint( 500, 27500 ), MakeSize( 13333, 5000 ) )
oDrawPage.add( oShape )
oShape.GraphicURL = cUrl
End Sub
Code: Select all
sub __Main
rem ----------------------------------------------------------------------
rem define variables
dim document as object
dim dispatcher as object
rem ----------------------------------------------------------------------
rem get access to the document
document = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
rem ----------------------------------------------------------------------
dim args1(2) as new com.sun.star.beans.PropertyValue
args1(0).Name = "FileName"
args1(0).Value = "file://kamsslab-ir/R/source/st_ku_pet.jpg"
args1(1).Name = "FilterName"
args1(1).Value = "<All formats>"
args1(2).Name = "AsLink"
args1(2).Value = false
dispatcher.executeDispatch(document, ".uno:InsertGraphic", "", 0, args1())
end sub
but in second i don`t how resize and move picture.
dispatcher.executeDispatch(document, ".uno:SetObjectToBackground", "", 0, Array())