FastReport Business Graphics .NET,是一款基于fastreport报表开发控件的商业图形库,借助 FastReport 商业图形库,您可以可视化不同的分层数据,构建业务图表以进行进一步分析和决策。利用数据呈现领域专家针对 .NET 7、.NET Core、Blazor、ASP.NET、MVC、Windows Forms 和 Mono 提供的完整的产品
FastReport .NET是适用于.NET Core 3,ASP.NET,MVC和Windows窗体的全功能报告库。使用FastReport .NET,您可以创建独立于应用程序的.NET报告。
FastReport .net下载(qun:278631305)https://www.evget.com/product/1861/download
新事件 PageCreate 在 FastReport .NET 引擎中创建新页面时发生。在此阶段,您可以更改页面的属性。 StartPage、FinishPage 和 ManualBuild 等其他事件在构建页面模板开始/结束之前触发。
例如,您可以在横向和纵向页面方向之间交替。或者,借助此事件,您可以创建一个单独的数据源,其中包含有关 ExportAlias 或其他页面属性的信息。在事件执行过程中,您可以设置参数,并在下一页的开头迭代数据源。
以下示例描述了使用 PageCreate 事件定义 ExportAlias 的修改后的演示报告。
<?xml version="1.0" encoding="utf-8"?> <Report ScriptLanguage="CSharp" TextQuality="Regular" ReportInfo.Description="Demonstrates a group report. To create it: - go to "Report|Configure Bands..." menu; - press "Add" button and add a group header (this will add a data band and a group footer as well); - return to the report page, doubleclick the group header to show its editor." ReportInfo.Created="01/17/2008 04:31:41" ReportInfo.Modified="03/13/2024 17:32:59" 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 { private void Page1_CreatePage(object sender, EventArgs e) { if(Data1.DataSource.RowCount == 0) Data1.InitDataSource(); Page1.ExportAlias = Data1.DataSource["ProductName"].ToString().Substring(0,1); } } } </ScriptText> <Styles> <Style Name="EvenRows" Fill.Color="OldLace" Font="Arial, 10pt"/> </Styles> <Dictionary> <TableDataSource Name="Products" ReferenceName="NorthWind.Products" DataType="System.Int32" Enabled="true"> <Column Name="ProductID" DataType="System.Int32"/> <Column Name="ProductName" DataType="System.String"/> <Column Name="SupplierID" DataType="System.Int32"/> <Column Name="CategoryID" DataType="System.Int32"/> <Column Name="QuantityPerUnit" DataType="System.String"/> <Column Name="UnitPrice" DataType="System.Decimal"/> <Column Name="UnitsInStock" DataType="System.Int16"/> <Column Name="UnitsOnOrder" DataType="System.Int16"/> <Column Name="ReorderLevel" DataType="System.Int16"/> <Column Name="Discontinued" DataType="System.Boolean" BindableControl="CheckBox"/> <Column Name="EAN13" DataType="System.String"/> </TableDataSource> <Total Name="TotalProducts" TotalType="Count" Evaluator="Data1" PrintOn="GroupFooter1"/> </Dictionary> <ReportPage Name="Page1" Watermark.Font="Arial, 60pt" CreatePageEvent="Page1_CreatePage"> <ReportTitleBand Name="ReportTitle1" Width="718.2" Height="103.95" CanGrow="true"> <TextObject Name="Text1" Top="56.7" Width="718.2" Height="47.25" Text="ALPHABETICAL PRODUCT LIST" HorzAlign="Center" VertAlign="Center" Font="Tahoma, 14pt, style=Bold"/> <TextObject Name="Text11" Top="28.35" Width="718.2" Height="28.35" Anchor="Top, Left, Right" Fill.Color="WhiteSmoke" CanGrow="true" CanShrink="true" Text="[Report.ReportInfo.Description] " Padding="4, 4, 4, 4" Font="Tahoma, 8pt"/> <TextObject Name="Text18" Width="718.2" Height="28.35" Anchor="Top, Left, Right" Fill.Color="WhiteSmoke" Cursor="Hand" Hyperlink.Value="http://fast.report/cda2a" Hyperlink.OpenLinkInNewTab="true" Text="Learn how to build this report on the Fast Reports Academy channel" VertAlign="Center" Font="Tahoma, 10pt, style=Bold, Underline" TextFill.Color="Blue"/> </ReportTitleBand> <GroupHeaderBand Name="GroupHeader1" Top="107.15" Width="718.2" Height="37.8" StartNewPage="true" KeepWithData="true" Condition="[Products.ProductName].Substring(0,1)" SortOrder="None"> <TextObject Name="Text7" Left="9.45" Width="699.3" Height="37.8" Border.Lines="All" Border.Color="LightSkyBlue" Fill="LinearGradient" Fill.StartColor="LightSkyBlue" Fill.EndColor="AliceBlue" Fill.Angle="90" Fill.Focus="0.42" Fill.Contrast="1" Text="[[Products.ProductName].Substring(0,1)]" Padding="5, 0, 0, 0" VertAlign="Center" Font="Tahoma, 12pt, style=Bold"/> <DataBand Name="Data1" Top="148.15" Width="718.2" Height="18.9" DataSource="Products" KeepTogether="true"> <TextObject Name="Text2" Left="9.45" Width="604.8" Height="18.9" Border.Lines="Left" Border.Color="LightSkyBlue" Text="[Products.ProductName]" VertAlign="Center" Font="Tahoma, 8pt"> <Highlight> <Condition Expression="[Row#] % 2 == 0" Fill.Color="AliceBlue" TextFill.Color="Black" Font="Arial, 10pt" ApplyFill="true" ApplyTextFill="false"/> </Highlight> </TextObject> <TextObject Name="Text4" Left="614.25" Width="94.5" Height="18.9" Border.Lines="Right" Border.Color="LightSkyBlue" Text="[Products.UnitPrice]" Format="Currency" Format.UseLocale="true" Format.DecimalDigits="2" HorzAlign="Right" VertAlign="Center" Font="Tahoma, 8pt"> <Highlight> <Condition Expression="[Row#] % 2 == 0" Fill.Color="AliceBlue" TextFill.Color="Black" Font="Arial, 10pt" ApplyFill="true" ApplyTextFill="false"/> </Highlight> </TextObject> <Sort> <Sort Expression="[Products.ProductName]"/> </Sort> </DataBand> <GroupFooterBand Name="GroupFooter1" Top="170.25" Width="718.2" Height="47.25" KeepWithData="true"> <TextObject Name="Text8" Left="9.45" Width="699.3" Height="18.9" Border.Lines="Left, Right, Bottom" Border.Color="LightSkyBlue" Text="Total products: [TotalProducts]" HorzAlign="Right" VertAlign="Center" Font="Tahoma, 8pt, style=Bold"/> </GroupFooterBand> </GroupHeaderBand> <PageFooterBand Name="PageFooter1" Top="220.7" Width="718.2" Height="28.35" Fill.Color="WhiteSmoke"> <TextObject Name="Text9" Left="614.25" Width="94.5" Height="28.35" Text="[PageN]" HorzAlign="Right" VertAlign="Center" Font="Tahoma, 8pt"/> <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 .NET" VertAlign="Center" Font="Tahoma, 8pt, style=Underline" TextFill.Color="Blue"/> </PageFooterBand> </ReportPage> </Report>
将示例中的报表导出到 Excel 2007 的结果:
**注意 1.**调用新事件后,Engine.CurPage 会增加,并且由于 CurPage 是页面的索引,因此在创建前两个页面时,其值为 0。因此,我们建议在使用新事件时在报告脚本中使用单独的页面计数器。
**注意 2.**当将 Visible 属性更改为 false 时,页面的进一步构建将停止。
借助新属性,您可以移动到新的数据记录行并在添加新页面时修改页面属性。