打印本文 打印本文 关闭窗口 关闭窗口
上篇—水晶报表导出为word/excel文件的代码
作者:武汉SEO闵涛  文章来源:敏韬学习网  点击数1479  更新时间:2010/6/23 22:57:17  文章录入:mintao  责任编辑:mintao

using System;
using System.Collections;
using System.ComponentModel;
using System.Configuration;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using CrystalDecisions.Shared;
using CrystalDecisions.CrystalReports.Engine;
using System.IO;
using Ghy.Funds.FundsClassLibrary;
using System.Data.SqlClient;
namespace WebAppTest
{
/// <summary>
/// WebForm1 的摘要说明。
/// </summary>
public class WebForm1 : System.Web.UI.Page
{
   protected CrystalDecisions.Web.CrystalReportViewer CrystalReportViewer1;
   protected System.Web.UI.WebControls.DropDownList DropDownList1;
   protected System.Web.UI.WebControls.Button Btn_Export;
   protected System.Web.UI.WebControls.DropDownList DropDownList2;
   protected System.Web.UI.WebControls.Button btn_Export2;
   ReportDocument reportDoc=new ReportDocument();

   //页面加载
   //SqlConnection myconn = new SqlConnection(ConfigurationSettings.AppSettings["ConnectString"]);
   //SqlConnection myconn1 = new SqlConnection(ConfigurationSettings.AppSettings["ConnectString"]);
   //读取web.config配置文件中的数据库连接字符串,并连接到指定的数据库
 
   private void Page_Load(object sender, System.EventArgs e)
   {
    // Put user code to initialize the page here
    if (!Page.IsPostBack)
    {
     //测试的时候用绑定
              reportDataBind();
    }
  
   }

   #region Web Form Designer generated code
   override protected void OnInit(EventArgs e)
   {
    //
    // CODEGEN: This call is required by the ASP.NET Web Form Designer.
    //
    InitializeComponent();
    base.OnInit(e);
   }
 
   /// <summary>
   /// Required method for Designer support - do not modify
   /// the contents of this method with the code editor.
   /// </summary>
   private void InitializeComponent()
   {   
    this.btn_Export2.Click += new System.EventHandler(this.btn_Export2_Click);
    this.Load += new System.EventHandler(this.Page_Load);

   }
   #endregion

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