4,816
社区成员
![](https://csdnimg.cn/release/cmsfe/public/img/topic.427195d5.png)
![](https://csdnimg.cn/release/cmsfe/public/img/me.40a70ab0.png)
![](https://csdnimg.cn/release/cmsfe/public/img/task.87b52881.png)
![](https://csdnimg.cn/release/cmsfe/public/img/share-circle.3e0b7822.png)
protected void BtnDepsitAmtDesignPost_Click(object sender, EventArgs e) { string FileValue, PrintValue, ParaName, ParaValue; FileValue = FileToString(".\\Frp\\DepositAmt.fr3"); ParaName = "ShopName`~PrintDepositAdd`~PrintPaperNo`~Title"; //`~为各参数的分隔符 ParaValue = "测试酒楼" + "`~说明:本单据为贵客押金收取凭证,盖章有效。退房时请出示,遗失者自负,请妥善保存。退房时间为12:00时,延时退房18:00时以前按半天房费收取,18:00时以后算全天房价。押金单有效期为一个月,过期作废。 贵重物品请交前台寄存,未寄存丢失自负。 谢谢!" + "`~身份证:4325011980639512" + "`~押金单"; SqlConnection ConPrintTest = new SqlConnection(ConfigurationManager.ConnectionStrings["PrintTestConnectionString"].ToString()); ConPrintTest.Open(); DataSet DsCashLog = new DataSet(); SqlDataAdapter DaCashLog = new SqlDataAdapter("Select top 1 CashNo, CashDate, CashAmt, PayName, GuestName, RoomNo, ItemRemark, CashUserName, Remark From CashLog", ConPrintTest); DaCashLog.FillSchema(DsCashLog, SchemaType.Source, "CashLog"); DaCashLog.Fill(DsCashLog, "CashLog"); PrintValue = TableToXml(DsCashLog.Tables["CashLog"]); DsCashLog.Dispose(); ConPrintTest.Close(); string ScriptStr; ScriptStr = "<script language='javascript'>window.onload = function() { try { var ObjPrintMange = new ActiveXObject('WebPrint.WebPrintUnit'); } catch(e) { if( confirm('打印控件未安装,现在下载吗?') ) { window.location='./PrintActivex.exe'; } return; } var OldVersion=ObjPrintMange.Version; NewVerion='3.5(2011-02-17)'; if(OldVersion < NewVerion) { ObjPrintMange = null; alert('打印控件需升级。请先进行下载,下载后关闭IE,然后安装升级版。'); window.location='./PrintActivex.exe'; return; } " + " ObjPrintMange.CheckReg('公司名称', '3B8E5B998A3125EE89983EA940BB2AEE'); " //注册码 + " ObjPrintMange.ReportFileName='DepositAmt.fr3'; " + " ObjPrintMange.PostURL='http://www.xinyuerj.com/ASPPost/Show.asp?FileName=DepsitAmt.fr3'; " + " ObjPrintMange.DesignReport('" + FileValue + "' , '" + ParaName + "', '" + ParaValue + "', '" + PrintValue + "', '', '', '', '', '');" + "ObjPrintMange = null; } </script>"; ScriptStr = ScriptStr.Replace(System.Environment.NewLine, string.Empty); Response.Write(ScriptStr); }
public partial class Show : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { string FileName, FileValue; FileName = Request.QueryString["FileName"]; FileValue = Request.Form["ReportFileValue"]; WriteReportFile(FileName, FileValue); Response.Write("File Name" + FileName); Response.Write("File Value" + FileValue); } private void WriteReportFile(string FileName, string FileValue) { if ( FileName == null || FileName == "" || FileValue == null ||FileValue == "") return; File.WriteAllText(Server.MapPath(FileName), FileValue); } }