Skip to main content Skip to footer

Adding Vertical and Horizontal Lines in C1Report

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.

Adding lines at Design time in C1ReportDesigner

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 : ReportDesigner_Output You may download the sample report definition file. Download Sample

Adding lines at Run time in C1Report control

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 : SimpleReport GroupedReport Download Sample


comments powered by Disqus