OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

Enable Alternating Row Colors

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Calc
View previous topic :: View next topic  
Author Message
jsx
General User
General User


Joined: 20 Dec 2005
Posts: 5

PostPosted: Wed Jul 12, 2006 10:06 am    Post subject: Enable Alternating Row Colors Reply with quote

Is there a way to set up automatic Alternating Row Colors? I know I can manually hold down the ctrl key, select the row number, choose the background color and have the white/gray alternating rows that I want. BUT ... what if I need to insert a new row into the middle of my spread sheet later on?? I have to re-do all the colors?? Can someone help me? Maybe a theme? Maybe a Style?
Back to top
View user's profile Send private message Send e-mail
Villeroy
Super User
Super User


Joined: 04 Oct 2004
Posts: 7649
Location: Germany

PostPosted: Wed Jul 12, 2006 3:11 pm    Post subject: Reply with quote

You find customizable themes under Menu:Format>Auto Format...
One of the predefined auto-formats ("Yellow") alternates the background color of each second row. This will be done by hard formatting and bloats your file. Another problem is the insert-cells-problem you mentioned.
Format your sheet (or a blank one) as you like.
call stylist(F11)
For each type of formatted cell:
- Highlight cell: Ctrl+Click
- Drag to stylist
- Give a style name ("row_header","row_even","row_odd" or alike)

Select the range and call Menu:Format>Auto Format...
Notice the extra-options
Add new ...
Close
Now you have a new auto-format and when you insert a row, you just have to highlight and doubleclick a style-name. Or you may select the entire list-range and redo auto-formatting. (The latter has a nice side-effect: You can see, where you have inserted rows before you re-format.)
OK, let's do more with your named styles "row_even" and "row_odd".
Select your current list without headers (I assume A2:F100)
Notice which cell has the focus (I assume A2)
Type some name into the name-box left of formula-bar (I assume myList, no spaces allowed)
Remove all formatting (Del-key): Check formatting only.
Call Menu:Format>Conditional ...
Choose "Formula" for condition1
Formula: AND(NOT(ISERROR(A2!myList));MOD(ROW(A2);2)=1)
Style: "row_odd"
Choose "Formula" for condition2
Formula: AND(NOT(ISERROR(A2!myList));MOD(ROW(A2);2)=0)
Style: "row_even"
From the viewpoint of currently active cell A2 this will apply "row_odd" if A2 is in myList (intersection of A2 and myList is not an error) and if the row-number of A2 divided by 2 has residue 1.
From the viewpoint of currently active cell A2 this will apply "row_even" if A2 is in myList (intersection of A2 and myList is not an error) and if the row-number of A2 divided by 2 has residue 0.
If A2 is not in myList, the cell's formatting won't change.
Since named reference myList is an absolute reference ($sheetName.$A$2:$F$100)and A2 is a relative one, the conditional formatting of B4 will be:
Formula: AND(NOT(ISERROR(B4!myList));MOD(ROW(B4);2)=0)
Insertion of rows and columns adjusts the size of myList.
_________________
XUbuntu 9.04, OOo 3.1.1(Sun), Sun Java 1.5.0_06
Back to top
View user's profile Send private message
Dale
Super User
Super User


Joined: 21 Feb 2005
Posts: 1445
Location: Australia

PostPosted: Wed Jul 12, 2006 3:12 pm    Post subject: Reply with quote

Try selecting the range of interest and
Format > AutoFormat

If none of those options are what you want, you can use Conditional Formatting with ISEVEN(ROW()) as the condition. You will need to create appropriate cell styles first. See How to apply Conditional Formatting to a Cell for details. (It's a quick read with screen shots to make things clear)

+ + + + +
Villeroy and I posted at about the same time. I didn't know you could create your own AutoFormats.
_________________
Dale
To err is human, but to destroy your slippers in the process takes a real son of a bitch: Me!

OOo documentation from the source
http://documentation.openoffice.org
Guides, FAQ, How Tos
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Calc All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group