应用XML技术实现报表打印方案的设计与实现
笔者为了能够快速实现简单的报表打印,设计了下面的方案。编写一个通用打印页面,要打印报表将参数写入一个XML文档,调用页面XMLReport.aspx?report=报表名,即可完成报表的制作
3.1 创建自定义的XML报表文件
XML主要用来描述打印报表的名称,数据来源,格式,分页打印等信息,具体标签可自己定义,下面是笔者针对会员管理系统报表打印所制定的XML文档:
MemberList.xml
Member Information
Member List
MemberList
Data Source=localhost;User ID=sa;password=;Initial Catalog=XMLReport;
Select MemberID, prefix+'. '+ firstname+' '+ surname AS [Member Name],CityOrTown,State,PostCode, '$'+convert(varchar(12),FeesPaid) As Fees From Members;
10
Member Summary
MemberSummary
Data Source=localhost;User ID=sa;password=;Initial Catalog=XMLReport;