Column Datasource, Wrapped.frx 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <Report ScriptLanguage="CSharp" ReportInfo.Description="Demonstrates how to print multiple Table columns wrapped. To do this:&#13;&#10;- select the Table object;&#13;&#10;- go to the &quot;Properties&quot; window and set the &quot;Layout&quot; property to Wrapped;&#13;&#10;- set the &quot;WrappedGap&quot; if needed." ReportInfo.Created="01/17/2008 20:54:09" ReportInfo.Modified="04/07/2023 13:50:11" ReportInfo.CreatorVersion="1.0.0.0">
  3. <ScriptText>using System;
  4. using System.Collections;
  5. using System.Collections.Generic;
  6. using System.ComponentModel;
  7. using System.Windows.Forms;
  8. using System.Drawing;
  9. using System.Data;
  10. using FastReport;
  11. using FastReport.Data;
  12. using FastReport.Dialog;
  13. using FastReport.Barcode;
  14. using FastReport.Table;
  15. using FastReport.Utils;
  16. namespace FastReport
  17. {
  18. public class ReportScript
  19. {
  20. private void Table1_ManualBuild(object sender, EventArgs e)
  21. {
  22. // get the data source by its name
  23. DataSourceBase columnData = Report.GetDataSource(&quot;Employees&quot;);
  24. // init the data source
  25. columnData.Init();
  26. // print the first table column - it is a header
  27. Table1.PrintColumn(0);
  28. // each PrintColumn call must be followed by either PrintRow or PrintRows call
  29. // to print cells on the column
  30. Table1.PrintRows();
  31. // now enumerate the data source and print the table body
  32. while (columnData.HasMoreRows)
  33. {
  34. // print the table body
  35. Table1.PrintColumn(1);
  36. Table1.PrintRows();
  37. // go next data source row
  38. columnData.Next();
  39. }
  40. // print the last table column - it is a footer
  41. Table1.PrintColumn(2);
  42. Table1.PrintRows();
  43. }
  44. }
  45. }
  46. </ScriptText>
  47. <Dictionary>
  48. <TableDataSource Name="Employees" ReferenceName="NorthWind.Employees" DataType="System.Int32" Enabled="true">
  49. <Column Name="EmployeeID" DataType="System.Int32"/>
  50. <Column Name="LastName" DataType="System.String"/>
  51. <Column Name="FirstName" DataType="System.String"/>
  52. <Column Name="Title" DataType="System.String"/>
  53. <Column Name="TitleOfCourtesy" DataType="System.String"/>
  54. <Column Name="BirthDate" DataType="System.DateTime"/>
  55. <Column Name="HireDate" DataType="System.DateTime"/>
  56. <Column Name="Address" DataType="System.String"/>
  57. <Column Name="City" DataType="System.String"/>
  58. <Column Name="Region" DataType="System.String"/>
  59. <Column Name="PostalCode" DataType="System.String"/>
  60. <Column Name="Country" DataType="System.String"/>
  61. <Column Name="HomePhone" DataType="System.String"/>
  62. <Column Name="Extension" DataType="System.String"/>
  63. <Column Name="Photo" DataType="System.Byte[]" BindableControl="Picture"/>
  64. <Column Name="Notes" DataType="System.String"/>
  65. <Column Name="ReportsTo" DataType="System.Int32"/>
  66. </TableDataSource>
  67. </Dictionary>
  68. <ReportPage Name="Page1" Watermark.Font="Arial, 60pt">
  69. <ReportTitleBand Name="ReportTitle1" Width="718.2" Height="37.8" CanGrow="true">
  70. <TextObject Name="Text1" Width="718.2" Height="37.8" Text="EMPLOYEES" HorzAlign="Center" VertAlign="Center" Font="Segoe UI, 14pt, style=Bold"/>
  71. </ReportTitleBand>
  72. <DataBand Name="Data1" Top="39.8" Width="718.2" Height="236.25">
  73. <TableObject Name="Table1" Left="9.45" Top="18.9" Width="388.23" Height="198.45" Border.Lines="All" Border.Color="LightGray" Border.Width="2" FixedColumns="1" Layout="Wrapped" WrappedGap="18.9" ManualBuildEvent="Table1_ManualBuild">
  74. <TableColumn Name="Column1" Width="85.05"/>
  75. <TableColumn Name="Column2" MinWidth="141.75" Width="237.03" AutoSize="true"/>
  76. <TableColumn Name="Column3"/>
  77. <TableRow Name="Row1">
  78. <TableCell Name="Cell1" Border.Lines="All" Border.Color="LightGray" Text="Name" Padding="5, 0, 0, 0" VertAlign="Center" Font="Segoe UI, 9pt, style=Bold"/>
  79. <TableCell Name="Cell2" Border.Lines="All" Border.LeftLine.Color="LightGray" Border.LeftLine.Width="2" Border.TopLine.Color="LightGray" Border.RightLine.Color="LightGray" Border.RightLine.Width="2" Border.BottomLine.Color="LightGray" Text="[Employees.FirstName] [Employees.LastName]" Padding="5, 0, 0, 0" VertAlign="Center" Font="Segoe UI, 9pt"/>
  80. <TableCell Name="Cell23" Text="Total:&#13;&#10;[Count(Cell2)]" HorzAlign="Center" VertAlign="Center" Font="Segoe UI, 9pt" RowSpan="4"/>
  81. </TableRow>
  82. <TableRow Name="Row2">
  83. <TableCell Name="Cell6" Border.Lines="All" Border.Color="LightGray" Text="Title" Padding="5, 0, 0, 0" VertAlign="Center" Font="Segoe UI, 9pt, style=Bold"/>
  84. <TableCell Name="Cell7" Border.Lines="All" Border.LeftLine.Color="LightGray" Border.LeftLine.Width="2" Border.TopLine.Color="LightGray" Border.RightLine.Color="LightGray" Border.RightLine.Width="2" Border.BottomLine.Color="LightGray" Text="[Employees.Title]" Padding="5, 0, 0, 0" VertAlign="Center" Font="Segoe UI, 9pt"/>
  85. <TableCell Name="Cell24" Font="Segoe UI, 9pt"/>
  86. </TableRow>
  87. <TableRow Name="Row3">
  88. <TableCell Name="Cell11" Border.Lines="All" Border.Color="LightGray" Text="Phone" Padding="5, 0, 0, 0" VertAlign="Center" Font="Segoe UI, 9pt, style=Bold"/>
  89. <TableCell Name="Cell12" Border.Lines="All" Border.LeftLine.Color="LightGray" Border.LeftLine.Width="2" Border.TopLine.Color="LightGray" Border.RightLine.Color="LightGray" Border.RightLine.Width="2" Border.BottomLine.Color="LightGray" Text="[Employees.HomePhone]" Padding="5, 0, 0, 0" VertAlign="Center" Font="Segoe UI, 9pt"/>
  90. <TableCell Name="Cell25" Font="Segoe UI, 9pt"/>
  91. </TableRow>
  92. <TableRow Name="Row5" Height="141.75">
  93. <TableCell Name="Cell21" Border.Lines="All" Border.Color="LightGray" Text="Photo" Padding="5, 0, 0, 0" VertAlign="Center" Font="Segoe UI, 9pt, style=Bold"/>
  94. <TableCell Name="Cell22" Border.Lines="All" Border.LeftLine.Color="LightGray" Border.LeftLine.Width="2" Border.TopLine.Color="LightGray" Border.RightLine.Color="LightGray" Border.RightLine.Width="2" Border.BottomLine.Color="LightGray" VertAlign="Center" Font="Segoe UI, 9pt">
  95. <PictureObject Name="Picture1" Left="9.45" Top="9.45" Width="122.85" Height="122.85" DataColumn="Employees.Photo"/>
  96. </TableCell>
  97. <TableCell Name="Cell26" Font="Segoe UI, 9pt"/>
  98. </TableRow>
  99. </TableObject>
  100. </DataBand>
  101. <PageFooterBand Name="PageFooter1" Top="278.05" Width="718.2" Height="28.35" Fill.Color="WhiteSmoke">
  102. <TextObject Name="Text2" Left="614.25" Width="94.5" Height="28.35" Text="[PageN]" HorzAlign="Right" VertAlign="Center" Font="Segoe UI, 9pt"/>
  103. <TextObject Name="Text12" Left="9.45" Width="217.35" Height="28.35" Cursor="Hand" Hyperlink.Value="https://www.fast-report.com/en/product/fast-report-net/" Text="Generated by FastReport" VertAlign="Center" Font="Segoe UI, 9pt, style=Underline" TextFill.Color="Blue"/>
  104. </PageFooterBand>
  105. </ReportPage>
  106. </Report>