[Solved] Setting all screenshots in Calc sheet to anchor to

Creating a macro - Writing a Script - Using the API

[Solved] Setting all screenshots in Calc sheet to anchor to

Postby sanmahaan » Wed May 10, 2017 6:09 pm

Topic : Setting all screenshots in Calc sheet to anchor to cell
I am new to LibreOffice. I am used to macros in the XL environ
Wish to have the code to set all the screen shots in the Calc sheet ( and maybe for all sheets in the calc workbook)
to anchor on cell and not on page.
Thanks in advance.

( Not sure if i had posted this query in the wrong forum of CALC..but it does not seem to be listed too.. so am posting it here)
Last edited by RoryOF on Thu May 11, 2017 9:43 am, edited 3 times in total.
Reason: Added green tick [RoryOF, Moderator]
Libreoffice 4.0.2.2 on LINUX
sanmahaan
 
Posts: 12
Joined: Wed May 10, 2017 3:53 pm

Re: Setting all screenshots in Calc sheet to anchor to cell

Postby Zizi64 » Wed May 10, 2017 6:23 pm

The MS VBA for the Excel and the API functions of the AOO/LO are not compatible. You must rewrite all of your VBA macros based on the API (Application programming Interface) and one of the supportesd programming language.

Please upload an example document and some macro code here.

The LibreOffice has a littlebit higher compatibility (with the VBA codes) than the Apache OpenOffice.
Tibor Kovacs, Hungary; LibreOffice4.4.7 - Portable versions: LO3.3.0-LO5.3.3 and AOO4.1.3; on Win7x64Prof.
Please, edit the topic's initial post, and add the word "[Solved]" at the beginning of the subject line - if your problem has been solved.
User avatar
Zizi64
Volunteer
 
Posts: 5124
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: Setting all screenshots in Calc sheet to anchor to cell

Postby sanmahaan » Wed May 10, 2017 6:26 pm

I am not referring to any VB macros. I do not want to convert any macros.
Just want a simple code that will loop thru all the screen shots that I have put in CALC sheet, to anchor on the cell
as else on inserting rows, the entire document gets misaligned.
Thank you
Libreoffice 4.0.2.2 on LINUX
sanmahaan
 
Posts: 12
Joined: Wed May 10, 2017 3:53 pm

Re: Setting all screenshots in Calc sheet to anchor to cell

Postby Villeroy » Wed May 10, 2017 9:24 pm

Select all shapes on the current sheet so you can right-click the whole collection and do whatever you need.
Code: Select all   Expand viewCollapse view
Sub selectAllShapes()
   ctrl = ThisComponent.getCurrentController()
   sh = ctrl.getActiveSheet()
   dp = sh.getDrawPage()
   sc = createUnoService("com.sun.star.drawing.SvxShapeCollection")
   n = dp.getCount()
   for i = 0 to n-1
      sc.add(dp.getByIndex(i))
   next
   ctrl.select(sc)
End Sub
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 16.04, OpenOffice 4.x & LibreOffice 5.x
User avatar
Villeroy
Volunteer
 
Posts: 23730
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Setting all screenshots in Calc sheet to anchor to cell

Postby sanmahaan » Thu May 11, 2017 4:55 am

Thank you Villeroy...I shall try this and get back
Libreoffice 4.0.2.2 on LINUX
sanmahaan
 
Posts: 12
Joined: Wed May 10, 2017 3:53 pm

Re: Setting all screenshots in Calc sheet to anchor to cell

Postby sanmahaan » Thu May 11, 2017 9:33 am

Thank you Villeroy.. it worked with a some additions...this post can be closed
Libreoffice 4.0.2.2 on LINUX
sanmahaan
 
Posts: 12
Joined: Wed May 10, 2017 3:53 pm


Return to Macros and UNO API

Who is online

Users browsing this forum: No registered users and 8 guests