[Solved] Draw Border To Multiple Sheets at the same time

Creating a macro - Writing a Script - Using the API

[Solved] Draw Border To Multiple Sheets at the same time

Postby npandit » Mon Nov 11, 2019 10:37 am

I have been using this line to get a specific sheet to work with it
oSheet = oDoc.getSheets().getByIndex(0)
With the above line it draws border only to specified index sheet
But I want to use multiple sheets to draw border at the same time
How to do that ?
Last edited by Hagar Delest on Tue Nov 19, 2019 9:00 am, edited 2 times in total.
Reason: tagged solved
Open Office 4.1.7
npandit
 
Posts: 13
Joined: Mon Nov 11, 2019 10:09 am

Re: To Draw Border To Multiple Sheets at the same time

Postby musikai » Mon Nov 11, 2019 12:57 pm

Hi,

either you specify which sheets you want by changing the last number:
Code: Select all   Expand viewCollapse view
oDoc=ThisComponent
oSheet = oDoc.getSheets().getByIndex(0)
rem  do something
oSheet = oDoc.getSheets().getByIndex(1)
rem  do something


Or you can change all one by one:
Code: Select all   Expand viewCollapse view
oDoc=ThisComponent
for i=0 to oDoc.getsheets().count-1
oSheet = oDoc.getsheets().getbyindex(i)
rem  do something
next i
Win7 Pro, Lubuntu 15.10, LO 4.4.7, OO 4.1.3
Free Project: LibreOffice Songbook Architect (LOSA)
http://struckkai.blogspot.de/2015/04/libreofficesongbookarchitect.html
musikai
Volunteer
 
Posts: 254
Joined: Wed Nov 11, 2015 12:19 am

Re: To Draw Border To Multiple Sheets at the same time

Postby Villeroy » Mon Nov 11, 2019 1:04 pm

This is what templates are about. All office suites are mainly about templates. Generating new documents by means of program code is stupid even if you were able to program.
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: 27395
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: To Draw Border To Multiple Sheets at the same time

Postby npandit » Tue Nov 19, 2019 7:17 am

Hey
Thanks the For Loop worked .
But its applying border to all sheets now
I want to apply border from 2nd sheet till so on
i dont want border on the first sheet.
Can u please suggest code to apply border for all sheets except the first sheet?
Open Office 4.1.7
npandit
 
Posts: 13
Joined: Mon Nov 11, 2019 10:09 am

Re: To Draw Border To Multiple Sheets at the same time

Postby Zizi64 » Tue Nov 19, 2019 7:27 am

If you are a programmer, you must know the solution method.

Just start the Loop from 1 instead of the 0

Or you can apply a different Style to the first Sheet. Always work with styles instead of the direct formatting properties!
The Styles is the most valable property of the AOO/LO.

Or simple open a preformatted Template by your program code, - as Villeroy suggested. Use the Styles for the formating the Template.
Tibor Kovacs, Hungary; LO6.1.6 on Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-6.3.3; AOO4.1.6
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
User avatar
Zizi64
Volunteer
 
Posts: 8557
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: To Draw Border To Multiple Sheets at the same time

Postby npandit » Tue Nov 19, 2019 8:04 am

Thanks ZiZi
Thanks for the help means a lot
We all are learners here :)
Open Office 4.1.7
npandit
 
Posts: 13
Joined: Mon Nov 11, 2019 10:09 am


Return to Macros and UNO API

Who is online

Users browsing this forum: No registered users and 3 guests