LibreOffice Calc Alternate Background Color¶
The background row or column color is determined by the use of "conditional formatting" and which color is used is determined by the chosen cell style using "styles and formatting". Using this method well allow for adding or deleting a row or column without having to fix the alternating background colors.
Environment¶
Instructions were tested using the following.
- Arch Linux x86_64
- LibreOffice v7.5.0
Create New Cell Styles¶
These steps will create two styles, one for even row/column and one for odd row/column.
- Open "Styles and Formatting" using one of the following options.
- Menu Bar: Left mouse click on "Styles" > "Manage Styles".
- Notebook bar Tabbed: Left mouse click on "Home" > next to "Conditional" click on the drop down menu > "More Styles".
- Keyboard shortcut: CTRL+F5 or F11
- Create a new cell style.
- Click on the "Cell Style" icon (set square (triangle) with cells).
- Click on the "+" icon (plus sign).
- Enter the new style name (e.g. Background Even Row Color).
- Click on the "+" icon (plus sign).
- Enter the new style name (e.g. Background Odd Row Color).
- Set cell style background color.
- Right mouse click on the cell style "Background Even Row Color" then left mouse click on "Modify...".
- Left mouse click on "Background" and then left mouse click on the desired background color (e.g. Light Gray 4).
- Left mouse click on "Ok".
- Right mouse click on the cell style "Background Odd Row Color" then left mouse click on "Modify...".
- Left mouse click on "Background" and then left mouse click on the desired background color (e.g. White).
- Left mouse click on "Ok".
Note
If desired to separate cell styles for row and column, create two cell styles for each row (Background Even Row Color/Background Odd Row Color) and column (Background Even Column Color/Background Odd Column Color).
Apply Alternate Background Row Color¶
- Complete steps in "Create New Cell Styles".
- Select the range of cells that you wish to have alternating background colors.
- Left mouse click on the first desired cell in the range.
- Hold down the shift key then left mouse click on the last desired cell in the range.
- Use conditional formatting use one of the two directions.
- Menu Bar: Left mouse click on "Format" > "Conditional" > "Condition...".
- Notebook bar Tabbed: Left mouse click on "Home" > "Conditional" > "Condition...".
- Edit "Condition 1" in the "Conditional Formatting" dialog.
- Left mouse click on "Cell value" and change the selection to "Formula is".
- In the adjacent box enter without double quotes "ISEVEN(ROW())".
- Under "Apply Style" left mouse click on drown down menu and left mouse click on "Background Even Row Color".
- Add "Condition 2" by left mouse click on the "Add" button.
- Edit "Condition 2".
- Left mouse click on "Cell value" and change the selection to "Formula is".
- In the adjacent box enter without double quotes "ISODD(ROW())".
- Under "Apply Style" left mouse click on drop down menu and left mouse click on "Background Odd Row Color".
- Left mouse click on the "OK" button.
Example Screenshot¶
Apply Alternate Background Column Color¶
- Complete steps in "Create New Cell Styles".
- Select the range of cells that you wish to have alternating background colors.
- Left mouse click on the first desired cell in the range.
- Hold down the shift key then left mouse click on the last desired cell in the range.
- Use conditional formatting use one of the two directions.
- Menu Bar: Left mouse click on "Format" > "Conditional" > "Condition...".
- Notebook bar Tabbed: Left mouse click on "Home" > "Conditional" > "Condition...".
- Edit "Condition 1" in the "Conditional Formatting" dialog.
- Left mouse click on "Cell value" and change the selection to "Formula is".
- In the adjacent box enter without double quotes "ISEVEN(COLUMN())".
- Under "Apply Style" left mouse click on drown down menu and left mouse click on "Background Even Column Color".
- Add "Condition 2" by left mouse click on the "Add" button.
- Edit "Condition 2".
- Left mouse click on "Cell value" and change the selection to "Formula is".
- In the adjacent box enter without double quotes "ISODD(COLUMN())".
- Under "Apply Style" left mouse click on drop down menu and left mouse click on "Background Odd Column Color".
- Left mouse click on the "OK" button.