表生成器
Fastreport在线下单立享85折起!赶紧加入购物清单吧!
说到.Net框架,我们通常会想到#C编程语言。仅仅是因为C#程序员的人数众多。但是我们也不应忘记其他语言。例如,来自Stimulsoft的 告生成器的用户希望使用VB.Net语言的应用程序代码创建 告:
“目前,我只是在测试,我想使用VB中的代码创建一个 告。 目前,我试图显示一份我在VB中编写的标题的 告。但不向我显示Web应用程序中的任何内容。
您能否给我一些指导,以指导如何从VB设计 告并显示出来或者,如果我省略任何指示或对象来进行 告
像允许您从代码创建 告的任何其他 告生成器一样,可以从VB.Net语言的代码中使用Stimulsoft Reports.Net。开发人员已向用户解释了如何执行此操作。
实际上,它只是C#代码的一种解释:
Dim AppFolder As String Dim report As New Report() 'create instance of class Report Dim ds As New DataSet() 'create dataset object AppFolder = "C:UsersUsersourcereposVBCodeReportVBCodeReportApp_Data" 'load data ds.ReadXml(AppFolder + "nwind.xml") report.RegisterData(ds) report.GetDataSource("Products").Enabled = True 'create report page Dim page As New ReportPage() report.Pages.Add(page) 'add created page to report page collection page.CreateUniqueName() 'with generated name 'create group header band Dim group As New GroupHeaderBand() page.Bands.Add(group) 'add the band to band collection group.CreateUniqueName() 'with generated name group.Height = Units.Centimeters * 1 group.Condition = "[Products.ProductName].Substring(0,1)" 'set the group condition group.SortOrder = FastReport.SortOrder.Ascending 'and set sort order 'create text object Dim groupTxt As New TextObject() groupTxt.Parent = group 'set the object on whitch the text will be shown groupTxt.CreateUniqueName() groupTxt.Bounds = New RectangleF(0, 0, Units.Centimeters * 10, Units.Centimeters * 1) 'set the text object bounds groupTxt.Text = "[[Products.ProductName].Substring(0,1)]" 'set the text value groupTxt.Font = New Font("Arial", 14, FontStyle.Bold) 'set the font style groupTxt.VertAlign = VertAlign.Center ' set the text align groupTxt.Fill = New LinearGradientFill(Color.LightGoldenrodYellow, Color.Gold, 90, 0.5F, 1) 'set the text object fill 'create data band Dim data As New DataBand() group.Data = data 'set the group data data.CreateUniqueName() data.DataSource = report.GetDataSource("Products") 'set data band source data.Height = Units.Centimeters * 0.5F 'set data band height 'create one more text object Dim productText As New TextObject() productText.Parent = data 'add the text object to data band productText.CreateUniqueName() productText.Bounds = New RectangleF(0, 0, Units.Centimeters * 10, Units.Centimeters * 0.5F) 'set the text object bounds productText.Text = "[Products.ProductName]" 'set the text value 'create group footer band group.GroupFooter = New GroupFooterBand() group.GroupFooter.CreateUniqueName() group.GroupFooter.Height = Units.Centimeters * 1 'set the group footer height 'create total object Dim groupTotal As New Total() groupTotal.Name = "TotalRows" 'set total object name groupTotal.TotalType = TotalType.Count 'set total type groupTotal.Evaluator = data 'set the band for which the total will be calculated groupTotal.PrintOn = group.GroupFooter 'set the total place report.Dictionary.Totals.Add(groupTotal) 'add the total object to totals collection 'create text object Dim totalText As New TextObject() totalText.Parent = group.GroupFooter 'set the object on whitch the text will be shown totalText.CreateUniqueName() totalText.Bounds = New RectangleF(0, 0, Units.Centimeters * 10, Units.Centimeters * 0.5F) 'set the text object bounds totalText.Text = "Rows: [TotalRows]" 'set the text value totalText.HorzAlign = HorzAlign.Right 'set the text align totalText.Border.Lines = BorderLines.Top 'set the border lines type report.Show() 'show report
从代码和注释中可以清楚地看到,创建了带有数据分组的 告。但是,此示例显示了简单 表中使用最频繁的对象的工作。请注意,创建 告对象还不够,您仍然需要将其“放置”在要显示它的对象上。这是从代码正确创建 告的关键。

虽然FastReport Open Source是非常强大的,但仍然有许多限制,你可以点击下方链接查看具体差异。
【功能对比】 表开发工具FastReport Open Source和FastReport .NET都有哪些差异和限制
FastReport Open Source与FastReport .Net间的功能差异还是非常明显的,如果您是企业用户或是需要更完整的功能,建议您直接购买FastReport .Net,盛夏狂欢,在线下单立享85折起!点击查看优惠价格,或咨询在线客服了解详情。
标签:
声明:本站部分文章及图片源自用户投稿,如本站任何资料有侵权请您尽早请联系jinwei@zod.com.cn进行处理,非常感谢!