[Solved] How I can sent picture in Calc to background?

Creating a macro - Writing a Script - Using the API

[Solved] How I can sent picture in Calc to background?

Postby vick » Thu Nov 03, 2011 9:54 am

So i found two ways insert picture to calc document. But I don`t know how I can set attribute "to background"

first way:

Code: Select all   Expand viewCollapse view
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

second way
Code: Select all   Expand viewCollapse view
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())
- don`t worked !!!!!
Last edited by Hagar Delest on Fri Nov 04, 2011 1:25 pm, edited 3 times in total.
Reason: tagged [Solved].
libreoffice 3.3.2
vick
 
Posts: 2
Joined: Thu Nov 03, 2011 5:48 am

Re: how I can sent picture in Calc to background?

Postby Villeroy » Thu Nov 03, 2011 11:37 am

Recorded macros are not the way to go. You can not really program like this.
http://www.mediafire.com/?x20gqzjwyqm
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04, no OpenOffice, LibreOffice 6.x
User avatar
Villeroy
Volunteer
 
Posts: 27200
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: how I can sent picture in Calc to background?

Postby B Marcelly » Thu Nov 03, 2011 12:42 pm

Hi,
With your first method

Code: Select all   Expand viewCollapse view
' push graphic to background
oShape.LayerId = 1

' push graphic to usual layer
oShape.LayerId = 0
Bernard

OpenOffice.org 1.1.5 / Apache OpenOffice 4.1.1 / LibreOffice 5.0.5
MS-Windows 7 Home SP1
B Marcelly
Volunteer
 
Posts: 1160
Joined: Mon Oct 08, 2007 1:26 am
Location: France, Paris area

Re: How I can sent picture in Calc to background?

Postby vick » Thu Nov 03, 2011 4:02 pm

So thanks!!!

B Marcelly you solution is that what I found. Thanks!!!!
libreoffice 3.3.2
vick
 
Posts: 2
Joined: Thu Nov 03, 2011 5:48 am


Return to Macros and UNO API

Who is online

Users browsing this forum: No registered users and 3 guests