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

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
npandit
Posts: 16
Joined: Mon Nov 11, 2019 10:09 am

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

Post by npandit »

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
musikai
Volunteer
Posts: 294
Joined: Wed Nov 11, 2015 12:19 am

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

Post by musikai »

Hi,

either you specify which sheets you want by changing the last number:

Code: Select all

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

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/li ... itect.html
User avatar
Villeroy
Volunteer
Posts: 31279
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

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

Post by Villeroy »

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 with LibreOffice 6.0, latest OpenOffice and LibreOffice
npandit
Posts: 16
Joined: Mon Nov 11, 2019 10:09 am

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

Post by npandit »

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
User avatar
Zizi64
Volunteer
Posts: 11361
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

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

Post by Zizi64 »

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; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
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.
npandit
Posts: 16
Joined: Mon Nov 11, 2019 10:09 am

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

Post by npandit »

Thanks ZiZi
Thanks for the help means a lot
We all are learners here :)
Open Office 4.1.7
Post Reply