DataGrid分页打印
DataGrid显示的内容太多,需要分页打印.采用style='page-break-before: always'的方式,每页的最后一行要不没有显示,要不就是很细,并且会有一点出头.怎么解决? --------------------编程问答-------------------- <table id="tbButton" border="0" cellpadding="0" cellspacing="0" style="Z-INDEX: 101; LEFT: 0px; POSITION: absolute; TOP: 0px" width="100%">
<tr>
<td style="width:70px" Title="打印页面"><input style="width:60px" type="button" id="btnPrint" name="btnPrint" value="打印" onclick="return btnPrint_onclick();"></td>
<td style="width:70px" Title="打印预览"><input style="BACKGROUND-IMAGE: url(..\..\Images\Preview.gif);width:60px" type="button" id="btnPreView" name="btnPreView" value="预览" onclick="return PrintView();"></td>
<!--<td style="width:70px" Title="打印"><img src="../../Images/Print.ico" border="0" WIDTH="16" HEIGHT="16"><label style="Cursor:hand" onclick="return btnPrint_onclick();">打印</label></td>-->
<!--<td style="width:70px;border-bottom-style:dotted" Title="打印预览"><img src="../../Images/Preview.ico" border="0" WIDTH="16" HEIGHT="16"><label style="Cursor:hand" onclick="return PrintView();">预览</label></td>-->
<td style="width:70px" Title="打印设置"><input style="width:60px" type="button" id="btnSetup" name="btnSetup" value="打印设置" onclick="return PrintSetup();"></td>
<td style="width:70px" Title="关闭"><input style="width:60px" type="button" id="btnClose" name="btnClose" value="关闭" onclick="return Quit();"></td>
<!--<td style="width:70px" Title="退出"><img src="../../Images/Quit.ico" border="0" WIDTH="16" HEIGHT="16"><label style="Cursor:hand" onclick="return Quit();">退出</label></td>-->
<td style="width:600px"> </td>
</tr>
</table>
<OBJECT classid="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2" height="0" id="WebBrowser3" width="0" VIEWASTEXT>
</OBJECT>
<script language="javascript">
<!--
//-----------------------------------------------------------------------
function btnPrint_onclick()
{
document.all("tbButton").style.display = "none";
document.all.WebBrowser3.ExecWB(6,6)
document.all("tbButton").style.display = "";
}
//-----------------------------------------------------------------------
function PrintView()
{
//window.scrollTo(1,1)
document.all("tbButton").style.display = "none";
document.all.WebBrowser3.ExecWB(7,1); //打印预览
document.all("tbButton").style.display = "";
}
//-----------------------------------------------------------------------
function PrintSetup()
{
document.all.WebBrowser3.ExecWB(8,1) //打印设置
}
//-----------------------------------------------------------------------
function Quit()
{
window.close();
}
//-----------------------------------------------------------------------
-->
</script>
<table cellspacing="0" cellpadding="3" rules="all" border="2" id="DG_All" style="border-color:#6B6969;font-size:9pt;width:850px;">
<THEAD style='display:table-header-group;'><tr align="Center" valign="Middle" style="font-weight:bold;">
<td style="width:60px;">收文日期</td><td>来文单位</td><td>来文字号</td><td style="width:40px;">类别</td><td style="width:60px;">收文编号</td><td>文件题目</td><td style="width:20px;">份数</td><td style="width:60px;">处室</td><td style="width:60px;">签收人</td><td style="width:30px;"> </td>
</tr></THEAD><tr align="Center" valign="Middle">
<td>2003-02-17</td><td>a</td><td>[2003]3号</td><td>市内局</td><td>[2003]5</td><td>
aaa</td><td>1 </td><td>a室</td><td> </td><td> </td>
</tr><tr align="Center" valign="Middle">
<td>2003-02-17</td><td>b</td><td>[2003]3号</td><td>请示</td><td>[2003]11</td><td>
bbb</td><td>1 </td><td>b处</td><td> </td><td>存查</td>
</tr><tr align="Center" valign="Middle">
<td>2003-02-14</td><td>c</td><td>第2号</td><td>请示</td><td>[2003]20</td><td>
ccc</td><td>1 </td><td>c处</td><td> </td><td> </td>
</tr><tr align="Center" valign="Middle" style="PAGE-BREAK-AFTER:always;">
<td>2003-02-11</td><td>d</td><td>[2003]19号</td><td>市内局</td><td>[2003]3</td><td>
ddd</td><td>1 </td><td>d处</td><td> </td><td> </td>
</tr><tr align="Center" valign="Middle">
<td>2003-02-10</td><td>e</td><td>[2003]19号</td><td>市内局</td><td>[2003]3</td><td>
eee</td><td>1 </td><td>e处</td><td> </td><td> </td>
</tr><tr align="Center" valign="Middle">
<td>2003-02-17</td><td>f</td><td>[2003]3号</td><td>请示</td><td>[2003]11</td><td>
fff</td><td>1 </td><td>f处</td><td> </td><td>存查</td>
</tr><tr align="Center" valign="Middle">
<td>2003-02-17</td><td>g</td><td>[2003]3号</td><td>请示</td><td>[2003]11</td><td>
ggg</td><td>1 </td><td>g处</td><td> </td><td>存查</td>
</tr>
<tfoot style='display:table-footer-group;'><tr align="Center" valign="Middle" style="font-weight:bold;">
<td colspan="10">这里可以写页码</td>
</tr></tfoot>
</table> --------------------编程问答-------------------- 通过上段代码可以看出问题 --------------------编程问答-------------------- 代码没有问题,像种循环表头的打印有时候是会出现这种情况
--------------------编程问答-------------------- 但是我把表头表尾去掉也不行,还是同样的问题.
如果实在不行,有什么免费的第三方控件可以解决吗? --------------------编程问答-------------------- 现在的主要问题就是在tr后强制分页,这个线的显示可能就出时而不能出现.
麻烦一点的做法.
分页打印.
每隔一定的条数,再画一个表,包括表头,内容,尾
表与表之间用style="PAGE-BREAK-AFTER:always;"
中间还可加段空.
--------------------编程问答-------------------- <table cellspacing="0" cellpadding="3" rules="all" border="2" id="DG_All" style="border-color:#6B6969;font-size:9pt;width:850px;">
<tr align="Center" valign="Middle" style="font-weight:bold;">
<td style="width:60px;">收文日期</td><td>来文单位</td><td>来文字号</td>
</tr>
<tr align="Center" valign="Middle">
<td style="width:60px;">1</td><td>2</td><td>3</td>
</tr>
<tr align="Center" valign="Middle">
<td style="width:60px;">11</td><td>22</td><td>33</td>
</tr>
</table>
怎么通过javascipt把这段html变成
<table cellspacing="0" cellpadding="3" rules="all" border="2" id="DG_All" style="border-color:#6B6969;font-size:9pt;width:850px;">
<tr align="Center" valign="Middle" style="font-weight:bold;">
<td style="width:60px;">收文日期</td><td>来文单位</td><td>来文字号</td>
</tr>
<tr align="Center" valign="Middle">
<td style="width:60px;">1</td><td>2</td><td>3</td>
</tr>
</table>
<table cellspacing="0" cellpadding="3" rules="all" border="2" id="DG_All" style="border-color:#6B6969;font-size:9pt;width:850px;">
<tr align="Center" valign="Middle" style="font-weight:bold;">
<td style="width:60px;">收文日期</td><td>来文单位</td><td>来文字号</td>
</tr>
<tr align="Center" valign="Middle">
<td style="width:60px;">11</td><td>22</td><td>33</td>
</tr>
</table>
--------------------编程问答-------------------- 就是在第一,二行中间加
</table>
<p style='page-break-before: always'></p>
<table cellspacing="0" cellpadding="3" rules="all" border="2" id="DG_All" style="border-color:#6B6969;font-size:9pt;width:850px;">
<tr align="Center" valign="Middle" style="font-weight:bold;">
<td style="width:60px;">收文日期</td><td>来文单位</td><td>来文字号</td>
</tr> --------------------编程问答-------------------- 我也遇到此问题~!来学习一下 --------------------编程问答-------------------- gz --------------------编程问答-------------------- ```` --------------------编程问答-------------------- emark --------------------编程问答--------------------
<html>
<head>
<meta name=vs_targetSchema content="http://schemas.microsoft.com/intellisense/ie5">
<title>***上海市眼病防治中心病人结帐费用报表***</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<!--media=print 这个属性可以在打印时有效-->
<style media=print>
.Noprint{display:none;}
.PageNext{page-break-after: always;}
</style>
<style>
body,td,th
{
font-size: 12px;
}
.tdp
{
border-bottom: 1 solid #000000;
border-left: 1 solid #000000;
border-right: 0 solid #ffffff;
border-top: 0 solid #ffffff;
}
.tabp
{
border-color: #000000;
border-collapse:collapse;
}
.NOPRINT {
font-family: "宋体";
font-size: 12px;
}
</style>
</head>
<body >
<OBJECT id=WebBrowser classid=CLSID:8856F961-340A-11D0-A96B-00C04FD705A2 height=0 width=0 VIEWASTEXT>
</OBJECT>
<input type=button value=打印 onclick="document.all.WebBrowser.ExecWB(6,1)" class="NOPRINT">
<input type=button value=直接打印 onclick="document.all.WebBrowser.ExecWB(6,6)" class="NOPRINT">
<input type=button value=页面设置 onclick="document.all.WebBrowser.ExecWB(8,1)" class="NOPRINT">
<input type=button value=打印预览 onclick="document.all.WebBrowser.ExecWB(7,1)" class="NOPRINT">
<br/>
<table width="90%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr align="center">
<td colspan="5"><font size="3">上海市眼病防治中心病人结帐费用报表(A) </font></td>
</tr>
<tr>
<td>汇总人次 5</td>
<td>费用合计 15853.12</td>
<td>统计日期 </td>
<td>制表人 023</td>
<td>制表日期:2004-05-13</td>
</tr>
</table>
<table width="90%" border="1" align="center" cellpadding="2" cellspacing="0" bordercolor="#000000" class="tabp">
<tr>
<td >姓名</td>
<td >住院号</td>
<td >科室</td>
<td >结帐日期</td>
<td >出院日期</td>
<td >费用合计</td>
<td >医保交易费用</td>
<td >分类给付费用</td>
<td >非医保交易费</td>
<td > </td>
<td > </td>
<td > </td>
<td > </td>
<td > </td>
<td > </td>
</tr>
<tr>
<td > </td>
<td > </td>
<td > </td>
<td > </td>
<td > </td>
<td > </td>
<td > </td>
<td > </td>
<td > </td>
<td > </td>
<td > </td>
<td > </td>
<td > </td>
<td > </td>
</tr>
</table>
<hr align="center" width="90%" size="1" noshade class="NOPRINT" >
<!--分页-->
<div class="PageNext"></div>
<table width="90%" border="1" align="center" cellpadding="2" cellspacing="0" bordercolor="#000000" class="tabp">
<tr>
<td >第2页</td>
</tr>
<tr>
<td >看到分页了吧</td>
</tr>
<tr>
<td > </td>
</tr>
<tr>
<td > </td>
</tr>
<tr>
<td ><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="50%" >这样的报表
对一般的要求就够了。</td>
<td> </td>
</tr>
</table></td>
</tr>
</table>
</body>
</html>
--------------------编程问答-------------------- 0. --------------------编程问答-------------------- 学习一下! --------------------编程问答-------------------- --------------------编程问答-------------------- Click the link to solve your problem.Good luck!
补充:.NET技术 , ASP.NET