(50分求解)水晶报表打印纸张大小控制和打印报错问题??????急!!!
我使用的是VS2005自带的水晶报表,我在网站上放3个TEXT.BOX用来输入查询条件和一个查询按钮,拉入CrystalReportSource1和CrystalReportViewer1,格式设好的报表名CrystalReport。目的是通过点查询按钮Button1把资料查出来在已经定好格式的报表里显示,然后直接打印,我怎么把打印纸张大小固定呢?比如1/2letter 在VS2005里调试时可以在报表打印机里设置,预览正常,但在客户端连时报表大小就变了!还有就是查出资料后点打印按钮点打印时弹出“出现通信错误。将停止打印”。这该如何解决?C#代码:
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using CrystalDecisions.Shared;
using CrystalDecisions.CrystalReports.Engine;
using System.Data.SqlClient;
public partial class _Default : System.Web.UI.Page
{
protected void Button1_Click(object sender, EventArgs e)
{
if (TextBox1.Text == "")
{
TextBox1.Text = "0";
}
if (TextBox2.Text == "")
{
TextBox2.Text = "0";
}
if (TextBox3.Text == "")
{
TextBox3.Text = "0";
}
string sql = "SELECT Corpid, corpname, aliasname,fstcreate FROM corpbsl where corpid between ' " + TextBox1.Text + "' and '" + TextBox2.Text + "'or corpid='" + TextBox3.Text + "'";
string DBConfig_sql = @"Data Source=DESI;Initial Catalog=crmtmp;User ID=sa;Password=zy";
DataSet ds = new DataSet();
SqlConnection sqlCon = new SqlConnection(DBConfig_sql);
SqlCommand sqlCmd = new SqlCommand(sql, sqlCon);
SqlDataAdapter sqlAd = new SqlDataAdapter();
sqlAd.SelectCommand = sqlCmd;
sqlAd.Fill(ds, "sql");
CrystalReportSource1.ReportDocument.Load(Server.MapPath("CrystalReport.rpt"));
CrystalReportSource1.ReportDocument.SetDataSource(ds.Tables["sql"]);
CrystalReportSource1.DataBind();
CrystalReportViewer1.ReportSource = CrystalReportSource1;
CrystalReportViewer1.DataBind();
}
}