Name The Nastiest Theorem In Mathematics Worksheet Answer
前段时间,做了RDLC报表,主要是三块功能:
1、从DataGrid提取(包括最新的增删改)的数据,自动生成对应的RDLC报表文件(以流的形式驻存在内存中),用ReportViewer类来展示、打印、排版、预览、分页
1-1、提供一个提取任意控件数据的通用接口,然后拼接成DataTable这种网状的格子。DataGrid里修改、增加、删除等数据变动,立即同步更新到报表
2、给一个简单的RDLC模板,提供表头的字体格式和表内部数据等样式相关的信息,然后再用DataGrid里提取的数据,生成DataTable后其它必需信息,填充到报表里,
自动调整报表格式
3、做了一个TreeView,很简单;根据报表文件名称,切换左侧TreeView的Item,就加载不同的报表,显示数据。用了一点反射的知识
第一步:根据 Report Definition Language (RDL) 生成对应的类和命名空间。
1、去 http://schemas.microsoft.com/sqlserver/reporting/2010/01/reportdefinition/ 下载ReportDefinition2010.xsd。
注意:ReportDefinition和Visual Studio发布的有个时间差,官网上有ReportDefinition2005版和ReportDefinition2008版。ReportDefinition2005版,VS2008及以后才支持;
ReportDefinition2008版,VS2010及以后支持。2010版,要VS2012以后才支持。我的是VS2010,用ReportDefinition2008版就好。
2、找XML Schema Definition Tool (Xsd.exe),Windows操作系统会自带(微软会自带很多功能强大的exe,要是开源就好了)。For more detail,please refer to:
官网有详细的命令使用说明 https://msdn.microsoft.com/en-us/library/x6c1kb0s(v=vs.110).aspx
Below is my CMD in administator mode:
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\x64>xsd
/c /n:RDLC
/out:C:\Users\admin\Desktop\RDLCReportResearch
C:\Users\admin\Desktop\RDLCReportResearch\ReportDefinition.xsd
完了,生成的是这么个样子(ReportDefinition2005的生成出来有8000行左右,ReportDefinition2008的及以后有10000多行,贴一部分,样子参照下面代码)
![]()
using System.Xml.Serialization; /// <remarks/> [System.CodeDom.Compiler.GeneratedCodeAttribute(" xsd ", " 2.0.50727.3038 " )] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute( " code " )] [System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true, Namespace=" http://schemas.microsoft.com/sqlserver/reporting/2008/01/reportdefinition " )] [System.Xml.Serialization.XmlRootAttribute(Namespace=" http://schemas.microsoft.com/sqlserver/reporting/2008/01/reportdefinition ", IsNullable=false )] public partial class Report { private object [] itemsField; private ItemsChoiceType80[] itemsElementNameField; private System.Xml.XmlAttribute[] anyAttrField; /// <remarks/> [System.Xml.Serialization.XmlAnyElementAttribute()] [System.Xml.Serialization.XmlElementAttribute( " Author ", typeof(string ))] [System.Xml.Serialization.XmlElementAttribute( " AutoRefresh ", typeof(uint ))] [System.Xml.Serialization.XmlElementAttribute( " Body ", typeof (BodyType))] [System.Xml.Serialization.XmlElementAttribute( " Classes ", typeof (ClassesType))] [System.Xml.Serialization.XmlElementAttribute( " Code ", typeof(string ))] [System.Xml.Serialization.XmlElementAttribute( " CodeModules ", typeof (CodeModulesType))] [System.Xml.Serialization.XmlElementAttribute( " ConsumeContainerWhitespace ", typeof(bool))]ReportDefinition.cs
第二步:创建RDLCGenerator类和TablixRDLCGenerator类
1、根据下载的Report Definition Language(RDL)和一个创建的简单的RDLC文件,知道RDLC文件基本要有哪几部分组成;然后层层嵌套创建就出来了,很简单。
2-1、Tablix是关键数据区,GotReportViewer上面的例子,DynamicMatrix和DynamicTable是根据RDL2005来做的,RDL2008以后,就是一个Tablix:
2-2、Tablix的主要数据区域: TablixHierarchyType CreateTablixColumnHierarchy()和TablixHierarchyType CreateTablixRowHierarchy()
2-3、对于HeaderRow和DataRow关键就在下面的不同。
![]()
1 private LocIDStringWithDataTypeAttribute CreateTablixTextRunValue(bool isHeaderCell, string name) 2 { 3 LocIDStringWithDataTypeAttribute v = new LocIDStringWithDataTypeAttribute(); 4 v.Value = isHeaderCell ? name : " =Fields! " + name + " .Value " ; 5 v.DataType = StringWithDataTypeAttributeDataType.String; 6 return v; 7 }CreateTablixTextRunValue
2-4、DataSet的名字一定要和ReportDataSource里的名字完全匹配
RdlcGenerator的Read和Write方法比较重要。
![]()
/// table + matrix = tablix /// Microsoft 用一个tablix来支持Table(表), Matrix(矩阵) and List(列表)这三种报表项 /// 整合了table和matrix的功能View Code
![]()
#region Properties // DataGrid 的DataGridColumn的Header private List<string> headerNames = new List<string>(); public List<string> HeaderNames { get { return headerNames; } } // 对应DataGrid Binding的Path private List<string> fieldNames = new List<string>(); public List<string> FieldNames { get { return fieldNames; } } // 对应DataGrid Column的ActualWdith(因为实际的窗口宽度会重新计算) private List<double> widths = new List<double>(); public List<double> Widths { get { return widths; } } // 如果没有更新过页面设置,用ReportViewer的默认页面设置;否则用最新的页面设置 public PageSettings PageSettings { get; set ; } public string Headline { get; set ; } public string DataSourceName { get; set ; } public string DataSetName { get; set ; }

0 Response to "Name The Nastiest Theorem In Mathematics Worksheet Answer"
Post a Comment