C1Report offers to create various reports either in un-bound or bound mode. The control offers 'n' number of formatting options that help the customers to create the reports as per their requirement. When creating a report we may wish to display the data in tabular form, the 'Vertical' and 'Horizontal' lines being a major part of it. Adding lines is very simple in C1Report, just click on the 'AddLine' icon in the designer and place it at any desired position in one of the sections of the report. But doing this alone won't serve the purpose, as the lines do not grow, even on setting their 'CanGrow' property to 'true'. We need to set their 'Anchor' property to 'TopAndBottom' and set their co-ordinates with respect to other fields.
1. Select 'Add Line' from the design tab of the report designer. 2. Align the line vertically between the datafields in the Detail Section 3. Set the same values of 'Top' and 'Height' for each field of the detail section 4. For all the vertical-line fields set the 'Anchor' property to 'TopAndBottom' 5. Add one more line and align it horizontally below the datafields in the Detail Section 6. Set the 'Anchor' property of the horizontal-line field to 'Bottom' 7. Preview the report The Report with vertical and horizontal lines will appear as shown below : You may download the sample report definition file. Download Sample
1. Add a line in C1Report's detail section :
f = .Fields.Add("Vline1", "", 1000, 0, 10, 300)
2. Set the following properties of the line :
'for vertical lines f.Anchor = AnchorEnum.TopAndBottom 'for horizontal lines f.Anchor = AnchorEnum.Bottom 'for both vertical and horizontal lines f.LineSlant = LineSlantEnum.NoSlant f.BorderStyle = BorderStyleEnum.Solid f.BorderColor = Color.Black
Refer to the attached sample for complete code and implementation of the same. The output generated from the sample will look as below : Download Sample