打印本文 打印本文 关闭窗口 关闭窗口
ASP.NET中应用XML技术实现Web报表打印
作者:武汉SEO闵涛  文章来源:敏韬网  点击数3180  更新时间:2009/4/23 10:43:17  文章录入:mintao  责任编辑:mintao
nbsp;   </Report>

</XmlReport>

 

标签说明:

Page Title:报表标题

ApplyXSLT:应用样式表定制报表

SQLdaraConnection: 数据源连接字串,数据提供者为SQL server

OleDbConnection:数据源连接字串,数据提供者为OleDb

Sql:选取报表数据的sql语句

PageSize:分页打印,每页显示的记录条数

 

读者还可以自定义一些更精确的标签来控制报表。

 

3.2 创建通用打印页面

 

page_load时读取要打印的报表名

 

xmlFile = Request.QueryString["report"].ToString() + ".xml";

        

 

private void BindReports()

{

     DataSet dsXml = new DataSet();

     try

     {

         dsXml.ReadXml(Server.MapPath("Reports\\" + xmlFile));

         DataTable dtPage = dsXml.Tables["Page"];

         DataTable dtReport = dsXml.Tables["Report"];

         labelPageTitle.Text = dtPage.Rows[0]["Title"].ToString();

         for(int i = 0;i < dtReport.Rows.Count; i++)

         {

              GetLabel(i).Text = dtReport.Rows[i]["Title"].ToString();

              if(dtReport.Rows[i]["SQLdataConnection"].ToString() != String.Empty || dtReport.Rows[i]["Sql"].ToString() != String.Empty || dtReport.Rows[i]["OleDbConnection"].ToString() != String.Empty)

              {

                   DataGrid dg = GetDataGrid(i);

                   if(dtReport.Rows[i]["PageSize"].ToString() != String.Empty)

上一页  [1] [2] [3] [4]  下一页

打印本文 打印本文 关闭窗口 关闭窗口