Ask Your Question

Index - color grey every other line?? [closed]

asked 2018-02-06 23:13:24 +0100

Libre4dje gravatar image

updated 2020-07-20 12:39:47 +0100

Alex Kemp gravatar image

I have an index where I would like to make every other line grey or whatever color I now want to make it easier to follow each line. I know there is something called Autofomatting...but I cannot figure out how you can create my own formats?

Anyone who has a script or know if it already exist in LO..then where can I find this option? I want to be able to apply it to the marked area of my choosing.

Maybe it is also called shading to alternate rows!

edit retag flag offensive reopen merge delete

Closed for the following reason question is not relevant or outdated by Alex Kemp
close date 2020-07-20 12:40:27.558223

2 Answers

Sort by » oldest newest most voted

answered 2018-02-07 01:05:10 +0100

Lupp gravatar image

updated 2018-02-07 01:05:56 +0100

The standard solution is by Conditional Formatting in mode 'Formula is' and with condition ISEVEN(ROW()) or similar. Of course, you also need a cell style (derived from 'Default') for overlaying the different background color. See this example.

edit flag offensive delete link more


Thanks @Lupp. Is that a Sub in Basic? Similar to Visual Basic in Excel? Cause I looked at your example but cannot see your Sub in Basic nor see any formula's in cells? I'm interested in understand how to duplicate what you did.

Mark McLean gravatar imageMark McLean ( 2018-02-07 01:48:25 +0100 )edit

It's done by Conditional Formatting. Open the example and go Format > Conditional Formatting > Manage > Edit to see the conditional format(s) defined for the document. Each one consists of a Range(s) "name" and of one or more conditions selecting what named cell style (if any) is to be overlaid to the existing cell style / attributes for any cell in the Range(s) if it is in the view.
Doing something to a similar effect by user code is much more complicated and much less efficient.

Lupp gravatar imageLupp ( 2018-02-07 11:11:34 +0100 )edit

There are also disadvantages of the method. In specific the CF ranges often get absurdly fragemented during development / design of the sheets. I would advise to clean CF up when the design is finished.

Lupp gravatar imageLupp ( 2018-02-07 11:15:05 +0100 )edit

Thanks @Lupp, I have LO windows 10. I got this warning when running the example. ...LibreOffice requires a Java runtime environment (JRE) to perform this task. Please install a JRE and restart LibreOffice... I will play with it in a later date, First chore will be to install JRE!

Mark McLean gravatar imageMark McLean ( 2018-02-07 11:36:44 +0100 )edit

answered 2018-02-07 00:24:54 +0100

I guess I did it manually! :~) I formatted row 1 and 2, then highlighted row 1 and 2, copied them, then on row 3 hold down Shift then either arrow down, page down, or Crtl+Shift+down arrow, last option will take ya to the very bottom! Then Ctrl+v, or any other way you paste. Good luck. If ya want to just change format after you have a lot of data in cells, do same, only not just Paste, but Paste Special.

edit flag offensive delete link more

Question Tools



Asked: 2018-02-06 23:13:24 +0100

Seen: 7,895 times

Last updated: Feb 07 '18