开源 - WPF报表引擎
2009-12-26 00:19
483 查看
阅读: 1542 评论: 6 作者: 快乐学习 发表于 2009-12-19 10:22 原文链接
报表是每个做信息系统产品人员都应该关注的一部分,在WPF下很多人使用FlowDocuments来生成报表,这个虽然不错,但是对于复杂的报表来说还是需要一个报表引擎。
它是现在WPF版本下的一个报表引擎,目前版本还比较低(v0.5 alpha),但是可以作为以后OpenExpressAppWPF版本报表的预览控件的参考。
下面放上几张它例子的图,感兴趣的也可以去看看。
First things, first… Create a ReportDocument. This is the “container" for our report
view sourceprint?
Next, we need to supply a template for our report.
view sourceprint?
Here is how our template looks
view sourceprint?
I will go into more detail on how to customize this template in future posts. Now the data…
view sourceprint?
First add some “metadata”
view sourceprint?
And then the DataTables
view sourceprint?
Here, table is of type DataTable.
And that is it!
Finally export it to Xps and show
view sourceprint?
You can use the standard DocumentViewer to display the report
Read more
WPF multipage reports - Part I
WPF multipage reports - Part II - Data Grouping
WPF multipage reports - Part III - Rendering
WPF multipage reports - Part IV – Pagination
发表评论
新闻频道:2009年中国服务器操作系统市场分析
推荐链接:Windows 7专题发布
网站导航:博客园首页 个人主页 新闻 社区 博问 闪存 知识库
报表是每个做信息系统产品人员都应该关注的一部分,在WPF下很多人使用FlowDocuments来生成报表,这个虽然不错,但是对于复杂的报表来说还是需要一个报表引擎。
Open-Source .NET WPF Reporting Engine
“This project allows you to create reports using WPF (WindowsPresentation Foundation). Its supports headers and footers, DataTablebinding, barcode generation, XPS creation and more.”它是现在WPF版本下的一个报表引擎,目前版本还比较低(v0.5 alpha),但是可以作为以后OpenExpressAppWPF版本报表的预览控件的参考。
下面放上几张它例子的图,感兴趣的也可以去看看。
使用
Open-Source WPF Reporting EngineFlowDocuments
最开始说过有人使用FlowDocuments来做报表,以下为一个例子,想使用这个来作报表的可以参考。
WPF multipage reports - Part I
WPF multipage reports - Part II - Data Grouping
WPF multipage reports - Part III - Rendering
WPF multipage reports - Part IV – Pagination
First things, first… Create a ReportDocument. This is the “container" for our reportview sourceprint?
1 | ReportDocument reportDocument = new ReportDocument(); |
view sourceprint?
1 | StreamReader reader = new StreamReader( new FileStream( @"Templates\SimpleReport.xaml" , FileMode.Open, FileAccess.Read)); |
2 | reportDocument.XamlData = reader.ReadToEnd(); |
3 | reportDocument.XamlImagePath = Path.Combine(Environment.CurrentDirectory, @"Templates\" ); |
4 | reader.Close(); |
view sourceprint?
001 | < FlowDocument xmlns = "http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
002 | xmlns:x = "http://schemas.microsoft.com/winfx/2006/xaml" |
003 | xmlns:xrd = "clr-namespace:CodeReason.Reports.Document;assembly=CodeReason.Reports" |
004 | PageHeight = "29.7cm" PageWidth = "21cm" ColumnWidth = "21cm" > |
005 | < xrd:ReportProperties > |
006 | < xrd:ReportProperties.ReportName >SimpleReport</ xrd:ReportProperties.ReportName > |
007 | < xrd:ReportProperties.ReportTitle >Simple Report</ xrd:ReportProperties.ReportTitle > |
008 | </ xrd:ReportProperties > |
009 | < Section Padding = "80,10,40,10" FontSize = "12" > |
010 | < Paragraph FontSize = "24" FontWeight = "Bold" > |
011 | < xrd:InlineContextValue PropertyName = "ReportTitle" /> |
012 | </ Paragraph > |
013 | < Paragraph >This is a simple report example that contains a table. |
014 | The table is filled using a DataTable object.</ Paragraph > |
015 | < xrd:SectionDataGroup DataGroupName = "ItemList" > |
016 | < Paragraph FontSize = "20" FontWeight = "Bold" >Item List</ Paragraph > |
017 | < Table CellSpacing = "0" BorderBrush = "Black" BorderThickness = "0.02cm" > |
018 | < Table.Resources > |
019 | <!-- Style for header/footer rows. --> |
020 | < Style x:Key = "headerFooterRowStyle" TargetType = "{x:Type TableRowGroup}" > |
021 | < Setter Property = "FontWeight" Value = "DemiBold" /> |
022 | < Setter Property = "FontSize" Value = "16" /> |
023 | < Setter Property = "Background" Value = "LightGray" /> |
024 | </ Style > |
025 |
026 | <!-- Style for data rows. --> |
027 | < Style x:Key = "dataRowStyle" TargetType = "{x:Type TableRowGroup}" > |
028 | < Setter Property = "FontSize" Value = "12" /> |
029 | </ Style > |
030 |
031 | <!-- Style for data cells. --> |
032 | < Style TargetType = "{x:Type TableCell}" > |
033 | < Setter Property = "Padding" Value = "0.1cm" /> |
034 | < Setter Property = "BorderBrush" Value = "Black" /> |
035 | < Setter Property = "BorderThickness" Value = "0.01cm" /> |
036 | </ Style > |
037 | </ Table.Resources > |
038 |
039 | < Table.Columns > |
040 | < TableColumn Width = "0.5*" /> |
041 | < TableColumn Width = "2*" /> |
042 | < TableColumn Width = "*" /> |
043 | < TableColumn Width = "0.5*" /> |
044 | </ Table.Columns > |
045 | < TableRowGroup Style = '{StaticResource headerFooterRowStyle}' > |
046 | < TableRow > |
047 | < TableCell > |
048 | < Paragraph TextAlignment = 'Center' > |
049 | < Bold >Pos.</ Bold > |
050 | </ Paragraph > |
051 | </ TableCell > |
052 | < TableCell > |
053 | < Paragraph TextAlignment = 'Center' > |
054 | < Bold >Item Name</ Bold > |
055 | </ Paragraph > |
056 | </ TableCell > |
057 | < TableCell > |
058 | < Paragraph TextAlignment = 'Center' > |
059 | < Bold >EAN</ Bold > |
060 | </ Paragraph > |
061 | </ TableCell > |
062 | < TableCell > |
063 | < Paragraph TextAlignment = 'Center' > |
064 | < Bold >Count</ Bold > |
065 | </ Paragraph > |
066 | </ TableCell > |
067 | </ TableRow > |
068 | </ TableRowGroup > |
069 | < TableRowGroup Style = '{StaticResource dataRowStyle}' > |
070 | < xrd:TableRowForDataTable TableName = 'Ean' > |
071 | < TableCell > |
072 | < Paragraph > |
073 | < xrd:InlineTableCellValue PropertyName = 'Position' /> |
074 | </ Paragraph > |
075 | </ TableCell > |
076 | < TableCell > |
077 | < Paragraph > |
078 | < xrd:InlineTableCellValue PropertyName = 'Item' /> |
079 | </ Paragraph > |
080 | </ TableCell > |
081 | < TableCell > |
082 | < Paragraph > |
083 | < xrd:InlineTableCellValue PropertyName = 'EAN' /> |
084 | </ Paragraph > |
085 | </ TableCell > |
086 | < TableCell > |
087 | < Paragraph TextAlignment = 'Center' > |
088 | < xrd:InlineTableCellValue PropertyName = 'Count' AggregateGroup = 'ItemCount' /> |
089 | </ Paragraph > |
090 | </ TableCell > |
091 | </ xrd:TableRowForDataTable > |
092 | </ TableRowGroup > |
093 | </ Table > |
094 | < Paragraph > |
095 | There are |
096 | < xrd:InlineAggregateValue AggregateGroup = 'ItemCount' AggregateValueType = 'Count' EmptyValue = 'no' FontWeight = 'Bold' /> item positions with a total of |
097 | < xrd:InlineAggregateValue AggregateGroup = 'ItemCount' AggregateValueType = 'Sum' EmptyValue = '0' FontWeight = 'Bold' /> items listed. |
098 | </ Paragraph > |
099 | </ xrd:SectionDataGroup > |
100 | </ Section > |
101 | </ FlowDocument > |
view sourceprint?
1 | ReportData data = new ReportData(); |
view sourceprint?
1 | data.ReportDocumentValues.Add( "PrintDate" , DateTime.Now); |
view sourceprint?
1 | data.DataTables.Add(table); |
And that is it!
Finally export it to Xps and show
view sourceprint?
1 | XpsDocument xps = reportDocument.CreateXpsDocument(<strong>data</strong>); |
Read more
WPF multipage reports - Part I
WPF multipage reports - Part II - Data Grouping
WPF multipage reports - Part III - Rendering
WPF multipage reports - Part IV – Pagination
发表评论
新闻频道:2009年中国服务器操作系统市场分析
推荐链接:Windows 7专题发布
网站导航:博客园首页 个人主页 新闻 社区 博问 闪存 知识库
相关文章推荐
- 开源 - WPF报表引擎
- 开源WPF报表引擎 Open-Source .NET WPF Reporting Engine
- 报表引擎控件Stimulsoft Reports.Wpf
- MaltReport2:基于 OpenDocument-OpenOfficeXML 的开源报表引擎
- 比较不错的几款开源的WPF Charts报表控件
- MaltReport2:基于 OpenDocument-OpenOfficeXML 的开源报表引擎
- MaltReport2:基于 OpenDocument-OpenOfficeXML 的开源报表引擎
- 比较不错的几款开源的WPF Charts报表控件
- 比较不错的几款开源的WPF Charts报表控件
- 比较不错的几款开源的WPF Charts报表控件
- JasperReports是一个开源的java报表制作引擎
- MyReport报表引擎2.7.5.0主要新功能
- 7 款顶级开源 BI(商务智能)软件和报表工具
- birt报表引擎-将参数传递到数据集的查询条件
- 技术转载:八款开源 Android 游戏引擎 (巨好的资源)
- 7 款顶级开源 BI(商务智能)软件和报表工具
- 6款常用的Java开源报表制作工具
- 推荐6款常用的Java开源报表制作工具
- 常见开源游戏引擎收集
- 转载: 【社区专栏】陈书艺:Egret Html5开源游戏引擎背后的故事