加载中…
个人资料
  • 博客等级:
  • 博客积分:
  • 博客访问:
  • 关注人气:
  • 获赠金笔:0支
  • 赠出金笔:0支
  • 荣誉徽章:
正文 字体大小:

ASP.NET中实现Web打印的方案

(2009-01-14 16:12:16)
标签:

it

分类: ASP.NET
使用方法:

 

private static clsPrint m_clsPrint = new clsPrint();

private void Page_Load(object sender, System.EventArgs e)
{
if(!IsPostBack)
{
BindGrid();
}
}

 

private void DisplayGrid()
{

 

MyDataGrid.DataBind();
m_clsPrint.dgDataGrid = MyDataGrid;

 

}

 

private void btnPrint_Click(object sender, System.EventArgs e)
{
可使用方法和属性如下:

m_clsPrint.PageTitle = "权限列表";
m_clsPrint.PageNumber = 30;

string[] sShoulderLeft = new string[3];
string[] sShoulderCenter = new string[1];
string[] sShoulderRight = new string[2];

sShoulderLeft[0] = "左页眉一";
sShoulderLeft[1] = "左页眉二";
sShoulderLeft[2] = "左页眉三";

sShoulderCenter[0] = "中页眉一 ";

sShoulderRight[0] = "右页眉一";
sShoulderRight[1] = "右页眉二(共计XXXX名)";

m_clsPrint.ShoulderLeft = sShoulderLeft;
m_clsPrint.ShoulderCenter = sShoulderCenter;
m_clsPrint.ShoulderRight = sShoulderRight;

string[] sFooterLeft = new string[3];
string[] sFooterCenter = new string[1];
string[] sFooterRight = new string[2];

sFooterLeft[0] = "左页脚一制表人:XXX 制表日期:";
sFooterLeft[1] = "左页脚二复核人:XXX 复核日期:";
sFooterLeft[2] = "左页脚三XXX教学服务站(中心)XXXX入学年级";

sFooterCenter[0] = "中页脚一";

sFooterRight[0] = "右页脚一2009年18月40";
sFooterRight[1] = "右页脚二(共计XXXX名)";

m_clsPrint.FooterLeft = sFooterLeft;
m_clsPrint.FooterCenter = sFooterCenter;
m_clsPrint.FooterRight = sFooterRight;
m_clsPrint.SpanColumnList="0,1";

m_clsPrint.PrintView();

Page.RegisterStartupScript("show", "<script languge='javascript'>window.open('"+PageBase.UrlBase+"/printWindow.htm','_blank');</script>");

}

其中:PageBase.UrlBase是自己定义的返回的当前站点的URL

0

阅读 收藏 喜欢 打印举报/Report
  

新浪BLOG意见反馈留言板 欢迎批评指正

新浪简介 | About Sina | 广告服务 | 联系我们 | 招聘信息 | 网站律师 | SINA English | 产品答疑

新浪公司 版权所有