# Creating Alternating Rows

Learn how to create alternating rows in Spread.NET with easy-to-follow examples and code snippets.

## Content

You might want to set up your sheet so that alternating rows have a different appearance. For example, in a ledger, alternating rows often have a green background. In Spread, you can set up multiple alternating row appearances, which are applied in sequence, starting with the first row.
Set up the alternating rows using an index into the alternating row appearances. It might help to think of the default row appearance as the first alternating row style (or style zero, because the index is zero-based). Set the other alternating row appearances to subsequent indexes.
The figure here shows the results for the following example code for setting up alternating rows for every three rows.
![Alternating Rows Example](https://cdn.mescius.io/document-site-files/images/2238e618-a1fb-45a6-9ce5-9a4157bd2931/images/altrows.png)
For more details, refer to the [AlternatingRow](/spreadnet/api/latest/online-win/FarPoint.Win.Spread/FarPoint.Win.Spread.AlternatingRow.html) class.

## Using the Properties Window

1. At design time, in the **Properties** window, select the Spread component.
2. Select the **Sheets** property.
3. Click the button to display the **SheetView Collection Editor**.
4. Select the sheet for which you want to create alternating rows from the collection list.
5. Select the **AlternatingRows** property from the property list for that sheet.
6. If you want to add additional alternating rows patterns, set the **Count** property to the number of patterns you want.
7. Click the **AlternatingRows** property button to display the **AlternatingRow Collection Editor**.
8. Select alternating row pattern for which to set properties.
9. Set properties for the selected pattern using the property list.
10. Click **OK** to close the **AlternatingRow Collection Editor**.
11. Click **OK** to close the **SheetView Collection Editor**.

## Method to set

Set using the index to the AtermatingRows property of SheetView class.The default row style is the first style (with index "0") of the appearance of every other row.When applying the default row style to the first row, set the index after "1" to other row style.
**Example**
This example code creates a sheet that has three different appearance settings for rows. The first row uses the default appearance. The second row has a light blue background with navy text, and the third row has a light yellow background with navy text. This pattern repeats for all subsequent rows.

```csharp
fpSpread1.Sheets[0].AlternatingRows.Count = 3;
fpSpread1.Sheets[0].AlternatingRows[0].BackColor = Color.RoyalBlue;
fpSpread1.Sheets[0].AlternatingRows[0].ForeColor = Color.Navy;
fpSpread1.Sheets[0].AlternatingRows[1].BackColor = Color.LightYellow;
fpSpread1.Sheets[0].AlternatingRows[1].ForeColor = Color.Navy;
fpSpread1.Sheets[0].AlternatingRows[2].BackColor = Color.Salmon;
fpSpread1.Sheets[0].AlternatingRows[2].ForeColor = Color.Navy;
```

```vbnet
fpSpread1.Sheets(0).AlternatingRows.Count = 3
fpSpread1.Sheets(0).AlternatingRows(0).BackColor = Color.RoyalBlue
fpSpread1.Sheets(0).AlternatingRows(0).ForeColor = Color.Navy
fpSpread1.Sheets(0).AlternatingRows(1).BackColor = Color.LightYellow
fpSpread1.Sheets(0).AlternatingRows(1).ForeColor = Color.Navy
fpSpread1.Sheets(0).AlternatingRows(2).BackColor = Color.Salmon
fpSpread1.Sheets(0).AlternatingRows(2).ForeColor = Color.Navy
```

## Using the Spread Designer

1. Select the sheet tab for the sheet for which you want to set the alternating rows.
2. From the property list for that sheet, in the **Appearance** category, select the **AlternatingRows** property.
3. If you want to add additional alternating rows patterns, set the **Count** property to the number of patterns you want.
4. Click the **AlternatingRows** button to display the **AlternatingRow** **Collection Editor** as shown in the following figure.
<br>
    ![Designer Row Edit](https://cdn.mescius.io/document-site-files/images/2238e618-a1fb-45a6-9ce5-9a4157bd2931/images/altrowsedit.png)
5. Select alternating row pattern for which to set properties.
6. Set properties for the selected pattern using the property list.
7. Click **OK** to close the **AlternatingRow Collection Editor**.
8. From the **File** menu choose **Apply and Exit** to apply your changes to the component and exit Spread Designer.

## See Also

[Rows and Columns](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-ssobject-rowcol)
[Customizing the Number of Rows or Columns](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-ssobject-rowcol/spwin-rowcolnumber)
[Adding a Row or Column](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-ssobject-rowcol/spwin-rowcoladd)
[Removing a Row or Column](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-ssobject-rowcol/spwin-rowcolremove)
[Showing or Hiding a Row or Column](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-ssobject-rowcol/spwin-rowcolhide)
[Setting the Row Height or Column Width](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-ssobject-rowcol/spwin-rowcolsize)
[Setting Fixed (Frozen) Rows or Columns](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-ssobject-rowcol/spwin-rowcol-freeze)
[Moving Rows or Columns](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-ssobject-rowcol/spwin-rowcol-usermove)
[Setting up Preview Rows](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-ssobject-rowcol/spwin-previewrow)
[Input Data in Rows or Columns](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-ssobject-rowcol/spwin-rowcol-userentry)
[Rows or Columns That Have Data](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-ssobject-rowcol/spwin-rowcolnonempty)
[Adding a Tag to a Row or Column](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-ssobject-rowcol/spwin-tags-rowcol)