12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091 |
- <?xml version="1.0" encoding="utf-8"?>
- <Report ScriptLanguage="CSharp" ReportInfo.Description="Demonstrates how to print multiple Table rows and columns with a script. To do this: - select the Table object; - go to "Properties" window and click the "Events" button to view a list of available events; - doubleclick the "ManualBuild" event; - 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. 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">
- <ScriptText>using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Windows.Forms;
- using System.Drawing;
- using System.Data;
- using FastReport;
- using FastReport.Data;
- using FastReport.Dialog;
- using FastReport.Barcode;
- using FastReport.Table;
- using FastReport.Utils;
- namespace FastReport
- {
- public class ReportScript
- {
- // define two variables that will be printed in the report
- public int x;
- public int y;
- private void Table1_ManualBuild(object sender, EventArgs e)
- {
- // first we need to print the table header. Always follow the rule:
- // each table row must have the same number of columns.
-
- // print first two rows along with all its columns (the first
- // header column and 10 data columns)
- for (y = 0; y < 2; y++)
- {
- // print a row
- Table1.PrintRow(y);
-
- // print header column
- Table1.PrintColumn(0);
- // print 10 data columns
- for (x = 1; x <= 10; x++)
- {
- // print the data column (second column in the template)
- Table1.PrintColumn(1);
- }
- }
- // now print data rows.
- for (y = 1; y <= 10; y++)
- {
- // print the data row (third row in the template)
- Table1.PrintRow(2);
-
- // print header column
- Table1.PrintColumn(0);
- // print 10 data columns
- for (x = 1; x <= 10; x++)
- {
- // print the data column (second column in the template)
- Table1.PrintColumn(1);
- }
- }
- }
- }
- }
- </ScriptText>
- <Dictionary/>
- <ReportPage Name="Page1" Landscape="true" PaperWidth="297" PaperHeight="210" RawPaperSize="9" Watermark.Font="Arial, 60pt">
- <ReportTitleBand Name="ReportTitle1" Width="1047.06" Height="34.31" CanGrow="true"/>
- <DataBand Name="Data1" Top="36.31" Width="1047.06" Height="317.81">
- <TableObject Name="Table1" Top="5.96" Width="189" Height="302.4" ManualBuildEvent="Table1_ManualBuild">
- <TableColumn Name="Column1" Width="94.5"/>
- <TableColumn Name="Column2" Width="94.5"/>
- <TableRow Name="Row1" Height="113.4">
- <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"/>
- <TableCell Name="Cell2" Border.Lines="All" Border.Color="White" HorzAlign="Center" VertAlign="Center" Font="Segoe UI, 9pt"/>
- </TableRow>
- <TableRow Name="Row2" Height="94.5">
- <TableCell Name="Cell6" Border.Lines="All" Border.Color="White" Fill.Color="255, 192, 128" HorzAlign="Center" VertAlign="Center" Font="Segoe UI, 20pt"/>
- <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"/>
- </TableRow>
- <TableRow Name="Row3" Height="94.5">
- <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"/>
- <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"/>
- </TableRow>
- </TableObject>
- </DataBand>
- <PageFooterBand Name="PageFooter1" Top="356.12" Width="1047.06" Height="28.35" Fill.Color="WhiteSmoke">
- <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"/>
- </PageFooterBand>
- </ReportPage>
- </Report>
|