Table.frx 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <Report ScriptLanguage="CSharp" ReportInfo.Description="This report demonstrates the TableObject features.&#13;&#10;&#13;&#10;Learn more in the documentation https://www.fast-report.com/public_download/docs/FRNet/online/en/UserManual/en-US/DataBand/TableObject.html" ReportInfo.Created="06/03/2009 02:45:18" ReportInfo.Modified="03/28/2023 21:04:38" 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 Table2_ManualBuild(object sender, EventArgs e)
  21. {
  22. // initialize the data
  23. DataSourceBase data = Report.GetDataSource(&quot;Categories&quot;);
  24. data.Init();
  25. // print table header
  26. Table2.PrintRow(0);
  27. Table2.PrintColumns();
  28. data.First();
  29. while (data.HasMoreRows)
  30. {
  31. // print table body
  32. Table2.PrintRow(1);
  33. Table2.PrintColumns();
  34. // go next data row
  35. data.Next();
  36. }
  37. }
  38. private void Table3_ManualBuild(object sender, EventArgs e)
  39. {
  40. // get the data source by its name
  41. DataSourceBase columnData = Report.GetDataSource(&quot;Employees&quot;);
  42. // init the data source
  43. columnData.Init();
  44. // print the first table column - it is a header
  45. Table3.PrintColumn(0);
  46. // each PrintColumn call must be followed by either PrintRow or PrintRows call
  47. // to print cells on the column
  48. Table3.PrintRows();
  49. // now enumerate the data source and print the table body
  50. while (columnData.HasMoreRows)
  51. {
  52. // print the table body
  53. Table3.PrintColumn(1);
  54. Table3.PrintRows();
  55. // go next data source row
  56. columnData.Next();
  57. }
  58. // print the last table column - it is a footer
  59. Table3.PrintColumn(2);
  60. Table3.PrintRows();
  61. }
  62. }
  63. }
  64. </ScriptText>
  65. <Dictionary>
  66. <TableDataSource Name="Categories" ReferenceName="NorthWind.Categories" DataType="System.Int32" Enabled="true">
  67. <Column Name="CategoryID" DataType="System.Int32"/>
  68. <Column Name="CategoryName" DataType="System.String"/>
  69. <Column Name="Description" DataType="System.String"/>
  70. <Column Name="Picture" DataType="System.Byte[]" BindableControl="Picture"/>
  71. </TableDataSource>
  72. <TableDataSource Name="Employees" ReferenceName="NorthWind.Employees" DataType="System.Int32" Enabled="true">
  73. <Column Name="EmployeeID" DataType="System.Int32"/>
  74. <Column Name="LastName" DataType="System.String"/>
  75. <Column Name="FirstName" DataType="System.String"/>
  76. <Column Name="Title" DataType="System.String"/>
  77. <Column Name="TitleOfCourtesy" DataType="System.String"/>
  78. <Column Name="BirthDate" DataType="System.DateTime"/>
  79. <Column Name="HireDate" DataType="System.DateTime"/>
  80. <Column Name="Address" DataType="System.String"/>
  81. <Column Name="City" DataType="System.String"/>
  82. <Column Name="Region" DataType="System.String"/>
  83. <Column Name="PostalCode" DataType="System.String"/>
  84. <Column Name="Country" DataType="System.String"/>
  85. <Column Name="HomePhone" DataType="System.String"/>
  86. <Column Name="Extension" DataType="System.String"/>
  87. <Column Name="Photo" DataType="System.Byte[]" BindableControl="Picture"/>
  88. <Column Name="Notes" DataType="System.String"/>
  89. <Column Name="ReportsTo" DataType="System.Int32"/>
  90. </TableDataSource>
  91. </Dictionary>
  92. <ReportPage Name="Page1" Watermark.Font="Segoe UI, 60pt">
  93. <ReportTitleBand Name="ReportTitle1" Width="718.2" Height="37.8" CanGrow="true">
  94. <TextObject Name="Text30" Width="718.2" Height="37.8" Text="TableObject" HorzAlign="Center" VertAlign="Center" Font="Segoe UI, 14pt, style=Bold"/>
  95. </ReportTitleBand>
  96. <DataBand Name="Data1" Top="39.8" Width="718.2" Height="179.55" CanGrow="true">
  97. <TextObject Name="Text12" Left="9.45" Top="9.45" Width="699.3" Height="37.8" Fill.Color="110, 145, 190" Text="STATIC TABLE" VertAlign="Center" Font="Segoe UI, 16pt" TextFill.Color="White"/>
  98. <TableObject Name="Table1" Left="9.45" Top="66.15" Width="302.4" Height="113.4">
  99. <TableColumn Name="Column1" Width="75.6"/>
  100. <TableColumn Name="Column2" Width="75.6" AutoSize="true"/>
  101. <TableColumn Name="Column3" Width="75.6"/>
  102. <TableColumn Name="Column4" Width="75.6"/>
  103. <TableRow Name="Row1">
  104. <TableCell Name="Cell1" Border.Lines="All" Border.Color="Silver" Text="Cell with horizontal span" HorzAlign="Center" Font="Segoe UI, 9pt" ColSpan="3"/>
  105. <TableCell Name="Cell2" Border.Lines="All" Border.Color="Silver" Font="Segoe UI, 9pt"/>
  106. <TableCell Name="Cell3" Border.Lines="All" Border.Color="Silver" Font="Segoe UI, 9pt"/>
  107. <TableCell Name="Cell4" Border.Lines="All" Border.Color="Silver" Text="Cell with vertical span" HorzAlign="Center" VertAlign="Center" Font="Segoe UI, 9pt" RowSpan="3"/>
  108. </TableRow>
  109. <TableRow Name="Row2" AutoSize="true">
  110. <TableCell Name="Cell6" Border.Lines="All" Border.Color="Silver" Text="Row with auto-height" Font="Segoe UI, 9pt"/>
  111. <TableCell Name="Cell7" Border.Lines="All" Border.Color="Silver" Font="Segoe UI, 9pt"/>
  112. <TableCell Name="Cell8" Border.Lines="All" Border.Color="Silver" Font="Segoe UI, 9pt"/>
  113. <TableCell Name="Cell9" Border.Lines="All" Border.Color="Silver" HorzAlign="Center" VertAlign="Center" Font="Segoe UI, 9pt"/>
  114. </TableRow>
  115. <TableRow Name="Row3" Height="75.6">
  116. <TableCell Name="Cell11" Border.Lines="All" Border.Color="Silver" Font="Segoe UI, 9pt"/>
  117. <TableCell Name="Cell12" Border.Lines="All" Border.Color="Silver" Text="Column with auto-width" Font="Segoe UI, 9pt"/>
  118. <TableCell Name="Cell13" Border.Lines="All" Border.Color="Silver" Text="Cell with embedded object" Font="Segoe UI, 9pt">
  119. <CheckBoxObject Name="CheckBox1" Left="47.25" Top="37.8" Width="18.9" Height="18.9" Border.Lines="All" Border.Color="Silver"/>
  120. </TableCell>
  121. <TableCell Name="Cell14" Border.Lines="All" Border.Color="Silver" HorzAlign="Center" VertAlign="Center" Font="Segoe UI, 9pt"/>
  122. </TableRow>
  123. </TableObject>
  124. <ChildBand Name="Child1" Top="221.35" Width="718.2" Height="170.1">
  125. <TextObject Name="Text13" Left="9.45" Top="18.9" Width="699.3" Height="37.8" Fill.Color="110, 145, 190" Text="DYNAMIC TABLE (ROWS)" VertAlign="Center" Font="Segoe UI, 16pt" TextFill.Color="White"/>
  126. <TableObject Name="Table2" Left="9.45" Top="75.6" Width="538.65" Height="94.5" ManualBuildEvent="Table2_ManualBuild">
  127. <TableColumn Name="Column5" Width="151.2"/>
  128. <TableColumn Name="Column6" Width="264.6"/>
  129. <TableColumn Name="Column7" Width="122.85"/>
  130. <TableRow Name="Row4">
  131. <TableCell Name="Cell15" Border.Lines="All" Border.Color="Silver" Fill.Color="WhiteSmoke" Text="Category Name" HorzAlign="Center" Font="Segoe UI, 9pt, style=Bold"/>
  132. <TableCell Name="Cell16" Border.Lines="All" Border.Color="Silver" Fill.Color="WhiteSmoke" Text="Description" HorzAlign="Center" Font="Segoe UI, 9pt, style=Bold"/>
  133. <TableCell Name="Cell17" Border.Lines="All" Border.Color="Silver" Fill.Color="WhiteSmoke" Text="Picture" HorzAlign="Center" Font="Segoe UI, 9pt, style=Bold"/>
  134. </TableRow>
  135. <TableRow Name="Row5" Height="75.6">
  136. <TableCell Name="Cell20" Border.Lines="All" Border.Color="Silver" Text="[Categories.CategoryName]" Font="Segoe UI, 9pt"/>
  137. <TableCell Name="Cell21" Border.Lines="All" Border.Color="Silver" Text="[Categories.Description]" Font="Segoe UI, 9pt"/>
  138. <TableCell Name="Cell22" Border.Lines="All" Border.Color="Silver" Font="Segoe UI, 10pt">
  139. <PictureObject Name="Picture1" Left="2" Top="2" Width="117.85" Height="71.6" DataColumn="Categories.Picture" SizeMode="StretchImage"/>
  140. </TableCell>
  141. </TableRow>
  142. </TableObject>
  143. <ChildBand Name="Child2" Top="393.45" Width="718.2" Height="274.05" StartNewPage="true" FirstRowStartsNewPage="true">
  144. <TextObject Name="Text14" Left="9.45" Top="18.9" Width="699.3" Height="37.8" Fill.Color="110, 145, 190" Text="DYNAMIC TABLE (COLUMNS)" VertAlign="Center" Font="Segoe UI, 16pt" TextFill.Color="White"/>
  145. <TableObject Name="Table3" Left="9.45" Top="75.6" Width="292.95" Height="198.45" Border.Lines="All" Border.Color="LightGray" Border.Width="2" FixedColumns="1" ManualBuildEvent="Table3_ManualBuild">
  146. <TableColumn Name="Column8" Width="85.05"/>
  147. <TableColumn Name="Column9" MinWidth="141.75" Width="141.75" AutoSize="true"/>
  148. <TableColumn Name="Column10"/>
  149. <TableRow Name="Row6">
  150. <TableCell Name="Cell27" Border.Lines="All" Border.Color="LightGray" Text="Name" Padding="5, 0, 0, 0" VertAlign="Center" Font="Segoe UI, 9pt, style=Bold"/>
  151. <TableCell Name="Cell28" 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"/>
  152. <TableCell Name="Cell23" Text="Total:&#13;&#10;[Count(Cell28)]" HorzAlign="Center" VertAlign="Center" Font="Segoe UI, 9pt" RowSpan="4"/>
  153. </TableRow>
  154. <TableRow Name="Row7">
  155. <TableCell Name="Cell29" Border.Lines="All" Border.Color="LightGray" Text="Title" Padding="5, 0, 0, 0" VertAlign="Center" Font="Segoe UI, 9pt, style=Bold"/>
  156. <TableCell Name="Cell30" 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"/>
  157. <TableCell Name="Cell24" Font="Segoe UI, 10pt"/>
  158. </TableRow>
  159. <TableRow Name="Row8">
  160. <TableCell Name="Cell31" Border.Lines="All" Border.Color="LightGray" Text="Phone" Padding="5, 0, 0, 0" VertAlign="Center" Font="Segoe UI, 9pt, style=Bold"/>
  161. <TableCell Name="Cell32" 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"/>
  162. <TableCell Name="Cell25" Font="Segoe UI, 10pt"/>
  163. </TableRow>
  164. <TableRow Name="Row9" Height="141.75">
  165. <TableCell Name="Cell33" Border.Lines="All" Border.Color="LightGray" Text="Photo" Padding="5, 0, 0, 0" VertAlign="Center" Font="Segoe UI, 9pt, style=Bold"/>
  166. <TableCell Name="Cell34" 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">
  167. <PictureObject Name="Picture2" Left="9.45" Top="9.45" Width="122.85" Height="122.85" DataColumn="Employees.Photo"/>
  168. </TableCell>
  169. <TableCell Name="Cell26" Font="Segoe UI, 10pt"/>
  170. </TableRow>
  171. </TableObject>
  172. </ChildBand>
  173. </ChildBand>
  174. </DataBand>
  175. <PageFooterBand Name="PageFooter1" Top="669.5" Width="718.2" Height="28.35" Fill.Color="WhiteSmoke">
  176. <TextObject Name="Text31" 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"/>
  177. <TextObject Name="Text10" Left="614.25" Width="94.5" Height="28.35" Text="[PageN]" HorzAlign="Right" VertAlign="Center" Font="Segoe UI, 9pt"/>
  178. </PageFooterBand>
  179. </ReportPage>
  180. </Report>