Displaying data through newspaper columns is always a preferred practice in any Reporting service. It not only presents the focused and salient content but also makes the reports look more professional. ComponentOne Reports for WinForms provides us with features for creating Columnar Reports. Basically, Reports for WinForms provides two distinctly different methods for generating reports:
- Using the C1Report component
- Using C1PrintDocument
In this article, we will be discussing creating Columnar Reports using both of the above mentioned components.
MultiColumn layout reports can be directly created using the Columns and ColumnLayout properties of the Layout class in C1Reports. Columns property defines the number of Detail columns whereas ColumnLayout property is used to decide the direction of subsequent data in columns (Down/Across).
Layout l = _c1rReport.Layout; l.Columns = 2; l.ColumnLayout = ColumnLayoutEnum.Down;
In order to create Columnar Reports using C1PrintDocument, one needs to manually add the columns (of type C1.C1Preview.PageColumnDef) to Columns collection of PageLayout class. Now, Spacing and Width properties of PageColumnDef class can be used to define the spacing between the current and the next columns.
C1.C1Preview.PageColumnDef _pcdCol1 = new PageColumnDef("13cm", "1cm"); C1.C1Preview.PageColumnDef _pcdCol2 = new PageColumnDef("13cm", "0cm"); \_cpdReportDoc.PageLayout.Columns.Add(\_pcdCol1); \_cpdReportDoc.PageLayout.Columns.Add(\_pcdCol2);