首页 > 编程知识 正文

录入数据自动生成报告的系统,java报表工具有哪些

时间:2023-05-05 13:11:46 阅读:141095 作者:1351

FastReport .Net是针对Windows Forms、ASP.NET、MVC和. NET Core的全功能报告解决方案。 可在Microsoft Visual Studio 2005-2019中使用。 Net Framework 2.0-4.x,支持. NET Core 3.0或更高版本。

FastReport .NET 2021.1的新版本实现了对. NET 5的支持。 添加了新的条形码-Deutsce Post Leitcode。 大大改进了将RTF转换为报表对象的算法。 此外,还添加了用于转换数字的新功能。

请立即下载最新版本的FastReport.NET v2021.1

使用代码创建报告,可以考虑在代码中创建报告的方式。 编写以下报告:

报告报告=new report (; //register the ' products ' table report.registerdata (dataset1. tables [ ' products ' ],' products ' ); //enableittouseinareportreport.get data source (' products ).Enabled=true; //create a4 pagewithallmarginssetto1cmreportpagepage1=newreportpage (; page1.Name='Page1'; report.pages.add(page1; //createreporttitlebandpage1. report title=newreporttitleband (; page1. report title.name=' report title1'; //setitsheightto 1.5 cm page1. report title.height=units.centimeters * 1.5f; //creategroupheadergroupheaderbandgroup1=newgroupheaderband (; group1.Name='GroupHeader1'; group1. height=units.centimeters * 1; //setgroupconditiongroup1. condition=' [ products.product name ].substring (0,1 ) '; //addgrouptothepage.bandscollectionpage1. bands.add (group 1; //creategroupfootergroup1. group footer=newgroupfooterband (; group1. group footer.name=' group footer1'; group1. group footer.height=units.centimeters * 1; //createdatabanddatabanddata1=new data band (; data1.Name='Data1 '; data1.height=units.centimeters * 0.5f; //setdatasourcedata1. data source=report.get data source (' products ); //connectdatabandtoagroupgroup1. data=data1; working with windows.forms 23//create ' text ' objects//reporttitletextobjecttext1=new text object (; text1.Name='Text1'; //set bounds text1. bounds=newrectanglef (0,0,Units.Centimeters * 19,Units.Centimeters * 1); //set texttext1.Text='PRODUCTS '; //setappearancetext1. horz align=horz align.center; text1.font=newfont('Tahoma ',14,FontStyle.Bold ); //addittoreporttitlepage1. report title.objects.add (text1); //grouptextobjecttext2=new text object (; text2.Name='Text2'; text2. bounds=newrectanglef (0,0,Units.Centimeters * 2,Units.Centimeters * 1); text2. text=' [ products.product name ].substring (0,1 ) ]; text2.font=newfont('Tahoma ',10,FontStyle.Bold ); //addittogroupheadergroup1. objects.add (text2); //databandtextobjecttext3=new text object (; text3.Name='Text3'; text3. bounds=newrectanglef (0,0,Units.Centimeters * 10,Units.Centimeters * 0.5f ); text3. text=' [ products.product name ] '; text3.font=newfont('Tahoma ',8 ); //addittodatabanddata1. objects.add (text3); //groupfootertextobjecttext4=new text object (; text4.Name='Text4'; text4. bounds=newrectanglef (0,0,Units.Centimeters * 10,Units.Centimeters * 0.5f ); text4. text=' count : [ count of products ] '; text4.font=newfont('Tahoma ',8,FontStyle.Bold ); //addittogroupfootergroup1. group footer.objects.add (text 4; //addatotaltotalgrouptotal=new total (; group total.name=' count of products '; goup total.total type=total type.count; groupTotal.Evaluator=data1; group total.print on=group1. footer; //addittoreporttotalsreport.dictionary.totals.add (group total; //run the reportreport.Show (; 准备的报告如下

通过使用自己的预览窗口和EnvironmentSettings组件,可以调整标准预览窗口,如“设置FastReport.Net环境”部分所述。 相关属性包含在environment settings.preview settings属性中。

如果由于某种原因不希望使用标准预览窗口,可以创建自己的预览窗口。 要执行此操作,请使用可以添加到窗体的PreviewControl控件。 要在此控件中显示报表,请使用以下代码连接到报表对象:

report1. preview=preview control 1; 要准备并在PreviewControl中显示报告,请使用Report对象的Show方法。

报告1.show (; your_form.ShowDialog (; 或以下代码:

报告1.prepare () {报告1.show prepared }; your_form.ShowDialog (; }在这些示例中,your_form是包含PreviewControl的表单。

您可以使用PreviewControl组件的方法从代码中进行处理。 也可以使用ToolbarVisible、StatusbarVisible属性关闭标准工具栏和状态栏。 它在Demos/C#/CustomPreview示例项目中进行了演示。

您可以从“数据|添加数据源…”菜单中调用“数据向导”中筛选表数据的向导。 您可以在此设置连接并选择一个或多个数据表。 缺省情况下,向导会显示选定连接的所有可用表。 如果要过滤不需要的表,请使用“config.designer settings.filterconnectiont”菜单。 esignersettings.filterconnectiontables事件。 此示例说明如何从表列表中删除表1中的表。

using FastReport.Utils; config.designer settings.filterconnectiontables=filterconnectiontables; privatevoidfilterconnectiontables (object sender,filterconnectiontableseventargse ) if ) e.tablename=='table1' ) e }

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。