Index - color grey every other line??

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!

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.

1 Like

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.

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.

1 Like

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.

Thanks @Lupp, I have LO 5.3.4.2. 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!

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.