Multiplication Table.frx 4.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <Report ScriptLanguage="CSharp" ReportInfo.Description="Demonstrates how to print multiple Table rows and columns with a script. To do this:&#13;&#10;- select the Table object;&#13;&#10;- go to &quot;Properties&quot; window and click the &quot;Events&quot; button to view a list of available events;&#13;&#10;- doubleclick the &quot;ManualBuild&quot; event;&#13;&#10;- you will see an empty event handler. You need to print rows using TableObject.PrintRow method; in each row, you must also print all columns (using PrintColumns method). See the script's code for more details.&#13;&#10;When you run a report, the Table will repeat its rows and columns and fill them with data. Note that cell spans are handled automatically." ReportInfo.Created="05/16/2008 00:05:30" ReportInfo.Modified="04/07/2023 14:11:47" 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. // define two variables that will be printed in the report
  21. public int x;
  22. public int y;
  23. private void Table1_ManualBuild(object sender, EventArgs e)
  24. {
  25. // first we need to print the table header. Always follow the rule:
  26. // each table row must have the same number of columns.
  27. // print first two rows along with all its columns (the first
  28. // header column and 10 data columns)
  29. for (y = 0; y &lt; 2; y++)
  30. {
  31. // print a row
  32. Table1.PrintRow(y);
  33. // print header column
  34. Table1.PrintColumn(0);
  35. // print 10 data columns
  36. for (x = 1; x &lt;= 10; x++)
  37. {
  38. // print the data column (second column in the template)
  39. Table1.PrintColumn(1);
  40. }
  41. }
  42. // now print data rows.
  43. for (y = 1; y &lt;= 10; y++)
  44. {
  45. // print the data row (third row in the template)
  46. Table1.PrintRow(2);
  47. // print header column
  48. Table1.PrintColumn(0);
  49. // print 10 data columns
  50. for (x = 1; x &lt;= 10; x++)
  51. {
  52. // print the data column (second column in the template)
  53. Table1.PrintColumn(1);
  54. }
  55. }
  56. }
  57. }
  58. }
  59. </ScriptText>
  60. <Dictionary/>
  61. <ReportPage Name="Page1" Landscape="true" PaperWidth="297" PaperHeight="210" RawPaperSize="9" Watermark.Font="Arial, 60pt">
  62. <ReportTitleBand Name="ReportTitle1" Width="1047.06" Height="34.31" CanGrow="true"/>
  63. <DataBand Name="Data1" Top="36.31" Width="1047.06" Height="317.81">
  64. <TableObject Name="Table1" Top="5.96" Width="189" Height="302.4" ManualBuildEvent="Table1_ManualBuild">
  65. <TableColumn Name="Column1" Width="94.5"/>
  66. <TableColumn Name="Column2" Width="94.5"/>
  67. <TableRow Name="Row1" Height="113.4">
  68. <TableCell Name="Cell1" Border.Lines="All" Border.Color="White" Fill.Color="255, 192, 128" Text="The multiplication table" HorzAlign="Center" VertAlign="Center" Font="Segoe UI, 20pt, style=Bold" ColSpan="2"/>
  69. <TableCell Name="Cell2" Border.Lines="All" Border.Color="White" HorzAlign="Center" VertAlign="Center" Font="Segoe UI, 9pt"/>
  70. </TableRow>
  71. <TableRow Name="Row2" Height="94.5">
  72. <TableCell Name="Cell6" Border.Lines="All" Border.Color="White" Fill.Color="255, 192, 128" HorzAlign="Center" VertAlign="Center" Font="Segoe UI, 20pt"/>
  73. <TableCell Name="Cell7" Border.Lines="All" Border.Color="White" Fill.Color="255, 192, 128" Text="[x]" HorzAlign="Center" VertAlign="Center" Font="Segoe UI, 20pt, style=Bold"/>
  74. </TableRow>
  75. <TableRow Name="Row3" Height="94.5">
  76. <TableCell Name="Cell11" Border.Lines="All" Border.Color="White" Fill.Color="255, 192, 128" Text="[y]" HorzAlign="Center" VertAlign="Center" Font="Segoe UI, 20pt, style=Bold"/>
  77. <TableCell Name="Cell12" Border.Lines="All" Border.Color="White" Fill.Color="255, 224, 192" Text="[x * y]" HorzAlign="Center" VertAlign="Center" Font="Segoe UI, 20pt"/>
  78. </TableRow>
  79. </TableObject>
  80. </DataBand>
  81. <PageFooterBand Name="PageFooter1" Top="356.12" Width="1047.06" Height="28.35" Fill.Color="WhiteSmoke">
  82. <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"/>
  83. </PageFooterBand>
  84. </ReportPage>
  85. </Report>