新浪博客

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

2009-01-14 16:12阅读:
使用方法:
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 = sS
houlderRight;
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

我的更多文章

下载客户端阅读体验更佳

APP专享