Odd/Even Lines Highlighting

Different styles can be applied to even and odd lines of the data list to make easier to view the report. In order to design report of such type you should do the following:
  1. Create two styles in "Style Sheet Editor". As an example, you can define lighter background for the first one and darker for the second. Set styles’ Names to “EvenLine” and “OddLine” respectively. 

  2. Create “StyleName” binding for Detail that outputs the data. Binding script should return style name depending on the line number. In order to get current line number use TheBand.LineNumber, where TheBand is the name of band containing the Detail (this may be DataBand or GroupBand). If CrossBand is used, set CrossBand.StyleName binding depending on CrossBand.LineNumber property. 
In the figure:

1 - Two different styles in the style gallery.
2 - Binding for property Detail.StyleName implemented in C#:

Databand1.Linenumber % 2 == 0 ? "EvenLine" : "OddLine"

(Don't forget to set ScriptLanguage to CSharp in template properties).

Sample demonstrating apply of different styles to even and odd lines: styles.rst

Add Feedback