怎么让Web页中的表格的表头在每页都打印出来啊?

agent007 2004-09-27 02:17:29
我的要求是这样:一个在表格中列出很多条记录的页面,打印时会打印多张,如何使其标题和表头在每页开始都打印出来?
...全文
174 2 打赏 收藏 举报
写回复
2 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
梅雪香 2004-09-27
  • 打赏
  • 举报
回复

<td width="70%" style="font-size:12px;letter-spacing:0">条件:<c:out value="${aQuickSendFeeListBean.strQryCondition}"/></td>
<td width="30%" style="font-size:12px;letter-spacing:2"><c:out value="${aQuickSendFeeListBean.strStrikeYear}"/>年<c:out value="${aQuickSendFeeListBean.strStrikeMonth}"/>月</td>
</tr>
</table>
<table width="100%" border="1" align="center" cellpadding="0" cellspacing="0" style="border-collapse:collapse" bordercolor="#111111">
<tr height="25">
<td width="4%" align="center">序号</td>
<td width="7%" align="center">船名</td>
<td width="6%" align="center">公司</td>
<td width="10%" align="center">合同号</td>
<td width="6%" align="center">货种</td>
<td width="5%" align="center">签字吨</td>
<td width="7%" align="center">完工时间</td>
<td width="6%" align="center">外煤速滞</td>
<td width="5%" align="center">速滞费</td>
<td width="4%" align="center">速/滞</td>
<td width="4%" align="center">补贴费(¥)</td>
</tr>
</c:if>
<tr height="18" style="border:0 ">
<td align="center"><c:out value="${i}"/><c:set value="${pageScope['i']+1}" var="i"/></td>
<td align="center"><c:out value="${z.strShipName}"/></td>
<td align="center"><c:out value="${z.strBurCompanyKey}"/></td>
<td align="left" ><c:out value="${z.strBargainNumb}"/></td>
<td align="center" ><c:out value="${z.strLitterGoodsName}"/></td>
<td align="right" ><c:out value="${z.fltSignTon}"/></td>
<td align="center" ><c:out value="${z.strEndTime}"/>
<td align="right" ><c:if test="${z.fltWaiMsuzhi!=0}"><script language="javascript">/*alert('<c:out value="${z.fltWaiMsuzhi}"/>');*/document.write(format('<c:out value="${z.fltWaiMsuzhi}"/>'));</script><c:if test="${z.intCurrencySort==2}">¥</c:if><c:if test="${z.intCurrencySort==1}">$</c:if></c:if></td>
<td align="right" ><c:if test="${z.dblQSOrLateFee!=0}"><script language="javascript">document.write(format('<c:out value="${z.dblQSOrLateFee}"/>'));</script><c:if test="${z.intCurrencySort==2}">¥</c:if><c:if test="${z.intCurrencySort==1}">$</c:if></c:if></td>
<td align="center" ><c:out value="${z.strSqOrStick}"/></td>
<td align="right" ><c:if test="${z.dblSubsidyFee>0}"><script language="javascript">document.write(format('<c:out value="${z.dblSubsidyFee}"/>'));</script></c:if></td>
</tr>
<c:set value="${z.fltSignTon + pageScope['signton']}" var="signton"/>
<c:if test="${z.intCurrencySort==1}">
<c:set value="${z.fltWaiMsuzhi*100 + pageScope['wmszdollar']}" var="wmszdollar"/>
<c:set value="${z.dblQSOrLateFee*100 + pageScope['qsfeedollar']}" var="qsfeedollar"/>
</c:if>
<c:if test="${z.intCurrencySort==2}">
<c:set value="${z.fltWaiMsuzhi*100 + pageScope['wmszrmb']}" var="wmszrmb"/>
<c:set value="${z.dblQSOrLateFee*100 + pageScope['qsfeermb']}" var="qsfeermb"/>
</c:if>
<c:set value="${z.dblSubsidyFee*100 + pageScope['subsidyfee']}" var="subsidyfee"/>
<c:if test="${pageScope['i'] % 30 ==1 || rs.last}">
<tr height="15" >
<td align="center" rowspan="2">合计</td>
<td colspan="4" rowspan="2"> </td>
<td align="right" rowspan="2"><c:out value="${signton}"/></td>
<td rowspan="2"> </td>
<td align="right">$<script language="javascript">document.write(format('<c:out value="${wmszdollar/100}"/>'));</script></td>
<td align="right">$<script language="javascript">document.write(format('<c:out value="${qsfeedollar/100}"/>'));</script></td>
<td align="right" rowspan="2"></td>
<td align="right"></td>
</tr>
<tr height="15">
<td align="right">¥<script language="javascript">document.write(format('<c:out value="${wmszrmb/100}"/>'));</script></td>
<td align="right">¥<script language="javascript">document.write(format('<c:out value="${qsfeermb/100}"/>'));</script></td>
<td align="right">¥<script language="javascript">document.write(format('<c:out value="${subsidyfee/100}"/>'));</script></td>
</tr>
</table>
</c:if>
<c:if test="${pageScope['i'] % 30 ==1}">
<div class="PageNext"></div>
</c:if>
</c:forEach>
<c:if test="${pageScope['i'] ==1}"><h3 style="color:red" align="center">查询不到符合条件的记录!</h3></c:if>
</body>
</html>
我写的报表打印的jsp页面,希望对你有帮助!
梅雪香 2004-09-27
  • 打赏
  • 举报
回复
我有一份代码,jstl写的,如下:
<% //一般jsp都需要防止缓存
response.setHeader("Pragma","No-cache");
response.setHeader("Cache-Control","no-cache");
response.setDateHeader("Expires", 0);
%>
<%@ page contentType="text/html;charset=GBK" %>
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
<html>
<head>
<jsp:useBean class="quicksend.quicksendfee.bean.QuickSendFeeListBean" id="aQuickSendFeeListBean" scope="request"/>
<style>
td{font:宋体;
font-size:12px;
letter-spacing:-1;
}
</style>
<style media=print>
.Noprint{display:none;}
.PageNext{page-break-after: always;}
</style>
<script language="JavaScript" >
var isIesix=window.clientInformation.appVersion.indexOf("6.0");
function doPrintSetup(){
WB.ExecWB(8,1);
}
function doPrintPreview(){
tbPrintTool.style.display="none";
WB.ExecWB(7,1)
tbPrintTool.style.display="";
}
function doPrint(){
if(isIesix < 0){
tbPrintTool.style.display="none";
window.print();
tbPrintTool.style.display="";
}else {
tbPrintTool.style.display="none";
factory.printing.Print(false);//开始打印 true:显示提示 false:不显示提示
tbPrintTool.style.display="";
}
}
function SetPrintSettings() {
if(isIesix >= 0){
factory.printing.header = ""; //设置页眉
factory.printing.footer = "&b&P - &p"; //设置页脚
factory.printing.portrait = false; //设置横打竖打 true:竖打 false:横打
factory.printing.leftMargin = 15;//左边距
factory.printing.topMargin = 3;//上边距
factory.printing.rightMargin = 5;//右边距
factory.printing.bottomMargin = 3;//下边距
}else{
btnPrintSetup.style.display='none';
btnPrintView.style.display='none';
}
hh1.Click();
}
function format(num){
var arr=num.toString().split(".");
if(arr[1]){
return num+(arr[1].length==1?"0":"");
}else
return num+".00";
}
</script>
</head>
<body style="margin:0" onLoad="SetPrintSettings()">
<table id="tbPrintTool" border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>
<td> </td>
<td>
<img src="/scheduler/images/pagesetup.gif" name="btnPrintSetup" id="btnPrintSetup" onclick='doPrintSetup()' style="cursor:hand">
<img src="/scheduler/images/preview.gif" name="btnPrintView" id="btnPrintView" onclick='doPrintPreview()' style="cursor:hand">
<img src="/scheduler/images/print.gif" name="btnPrint" id="btnPrint" onclick='doPrint();' style="cursor:hand">
<object classid="clsid:1663ed61-23eb-11d2-b92f-008048fdd814" id="factory" codebase="/scheduler/ScriptX.cab#Version=6,1,431,8" style="display:none" viewastext></object>
<object classid='CLSID:8856F961-340A-11D0-A96B-00C04FD705A2' height='0' name='WB' width='0'></object>
<object id="hh1" classid="clsid:ADB880A6-D8FF-11CF-9377-00AA003B7A11"><param name="Command" value="Maximize"></object>
</td>
</tr>
</table>
<c:set value="${1}" var="i"/>
<c:set value="${0}" var="signton"/>
<c:set value="${0}" var="wmszdollar"/>
<c:set value="${0}" var="wmszrmb"/>
<c:set value="${0}" var="qsfeedollar"/>
<c:set value="${0}" var="qsfeermb"/>
<c:set value="${0}" var="subsidyfee"/>
<c:forEach items="${aQuickSendFeeListBean.lstItems}" var="z" varStatus="rs">
<c:if test="${rs.first || pageScope['i'] % 30 ==1}">
<h2 align="center" style="height:25">秦 皇 岛 港 务 集 团 有 限 公 司 单 船 速 遣 / 滞 期 登 记</h2>
<table border="0" cellpadding="0" cellspacing="0" style="width:100%;height:15;margin:0;font-size:12px;letter-spacing:2">
<tr>
相关推荐
发帖
JavaScript

8.7w+

社区成员

Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
帖子事件
创建了帖子
2004-09-27 02:17
社区公告
暂无公告