Example 3. Printing the name of the month |
Top Previous Next |
In the previous example, there were numbers of months printed in a matrix. This occurred, because the "Month" data column contains the number of the month, not its name. In order to print the name of the month, do the following:
private void Cell8_BeforePrint(object sender, EventArgs e) { string[] month Names = new string[] { "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" }; // Cell8 is a cell that prints the month number. // Cell8.Value is a value printed in the cell (i.e. the month number). // This value is of System.Object type, so we need to cast it to int Cell8.Text = monthNames[(int)Cell8.Value - 1]; }
When you run the report, you will have the following result:
|