联系我们
cms新闻网站系统、政府cms定制开发

广州网站建设公司-阅速公司

报纸新媒体网站内容发布一体化解决方案联系电话
/
http://www.kize.icu/
广州网站建设公司
您当前位置:首页>ASP.NET MVC

ASP.NET MVC

asp.net批量打印源码

发布时间:2009/4/21 9:51:29  作者:  阅读:1684  

private void printnoid(object noid)
{
conn.open();
string sqlp="";
sqlp="select noid,address,yb,company,linkman,imnkflx,tbimnkflx_2,printflag from kfzl where noid= "+noid+" order by noid desc";
SqlDataAdapter Adapter = new SqlDataAdapter(sqlp, conn.link);
DataSet myDs=new DataSet();
Adapter.Fill(myDs);
DataTable myTable=myDs.Tables[0];//重要

foreach(DataRow myRow in myTable.Rows)
{
if (myRow["printflag"].ToString() !="1")
{
Response.Write("<div class=PageNext></div>");
Response.Write("<p><br><br><br><br><br></p>");
Response.Write("<table width=92% border=0 align=center cellpadding=2 cellspacing=0><tr><td width=200 rowspan=6 class=tdp1>&nbsp;</td><td height=35 class=tdp1>"+myRow["yb"]+"</td></tr>");
Response.Write(" <tr><td height=32 class=tdp >寄:"+myRow["address"]+" </td></tr>");
Response.Write(" <tr> <td height=32 class=tdp>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "+myRow["company"]+"</td></tr>");
Response.Write(" <tr> <td height=46 class=tdp>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; "+myRow["linkman"]+"&nbsp;&nbsp; (收)</td></tr>");
Response.Write(" <tr><td height=376 >&nbsp;</td> </tr>");
Response.Write(" <tr> <td height=20 class=tdp2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 订阅 "+myRow["imnkflx"]+" "+ myRow["tbimnkflx_2"]+" "+myRow["noid"]+"</td></tr>");
Response.Write(" </table>");
//Response.Write("<hr align=center width=90% size=1 noshade class=NOPRINT >");
string sqlupdate="";
sqlupdate="update kfzl set printflag=1 where noid="+noid;
SqlCommand command2=new SqlCommand(sqlupdate,conn.link);
command2.ExecuteNonQuery();
}

}
conn.link.Close();
}

private void haosubmit_Click(object sender, System.EventArgs e)
{
// 打印页面
Response.Write(" <style media=print> .Noprint{display:none;} .PageNext{page-break-after: always;}</style>");
Response.Write("<style> #hao { position: absolute; top: 180px;right:215px; font-family: 宋体;font-size: 13px;color: 6BBA6B;letter-spacing: 2px;filter: alpha(opactiy=100);} .tdp2{ font-size: 11px; } .tdp{ font-size: 16px; } .tdp1{ font-size: 18px; letter-spacing: 23px;}");
Response.Write(" .NOPRINT { font-size: 13px; } </style>");
Response.Write("<center class=Noprint > <p><br> <input type=button =' 打 印 ' =all.WebBrowser.ExecWB(6,1)> &nbsp; <input type=button =直接打印 =all.WebBrowser.ExecWB(6,6)>&nbsp;");
Response.Write(" <input type=button =页面设置 =all.WebBrowser.ExecWB(8,1)></p> <p> <input type=button =打印预览 =all.WebBrowser.ExecWB(7,1)>&nbsp; <input type=button =' 撤 销 ' =all.WebBrowser.ExecWB(15,1)> &nbsp;&nbsp;共 <font color=red>"+Khzl_DataGrid.Items.Count+"</font> 封 </p> <hr align=center width=90% size=1 noshade> <div id=hao > 请在页面设置里选择横向打印,去掉页眉、页脚<em>!</em>打印300封以上时,需要耐心等待加载……<br><br><br> 打印中,本页面请不要关闭 <em>!</em></div></center>");
Response.Write("<OBJECT id=WebBrowser classid=CLSID:8856F961-340A-11D0-A96B-00C04FD705A2 height=0 width=0></OBJECT>");

//输出打印页面开始
string pnoid="";
int j=0;
for (int i=0;i<Khzl_DataGrid.Items.Count; i++)
{
CheckBox printtemp=(CheckBox)Khzl_DataGrid.Items[i].FindControl("printtemp");
DataBoundLiteralControl haonoid=(DataBoundLiteralControl)Khzl_DataGrid.Items[i].Cells[0].Controls[0];
pnoid=haonoid.Text.ToString();
if (printtemp.Checked==true)//printtemp1=printtemp1+"hao"+i+pnoid;
{printnoid(pnoid);
j=j+1;
Session["printcount"]=j.ToString();
}
}
}

}

相关文章
asp.net批量打印源码
cms新闻系统购买咨询
扫描关注 广州阅速软件科技有限公司
扫描关注 广州阅速科技
莱万特s
安徽时时计划软件手机版式 2元彩票网电脑版走势图 单机游戏消灭糖果 秒速飞艇规则 广西快3开奖助手软件 内蒙古时时历史记录查询 亚洲赛马会资料 云凤电玩城注册送分 500彩票网必发指数 手游打鱼捕鱼怎么破解 江苏新时时 陕西快乐十分最新玩法 双色球下期预测最精准 赛车8码 3d杀号网单选网 福彩3d乐彩论坛