代码之家  ›  专栏  ›  技术社区  ›  Hanz Cheah

HTML ASP Classic打印时如何删除空页2

  •  0
  • Hanz Cheah  · 技术社区  · 6 年前

    HTML table . 我设法把一切都安排妥当。我还运行了一个循环来插入一些空行,以填补记录较少时的空白。这将把页脚推到页面底部。问题是当我单击“打印”时。它总是给我两张纸,第二张完全是空的。我试着减少记录的数量,确保只有一页。但点击Print后,仍然显示2页,第2页为空。无论如何,要删除第2页,请帮助

    <html>
    <body>
    <center>
    <%
        call pageHeader()
    
        dTotNet_Amt = 0
    
        do while not rstERSLS1.eof
    
            record = record + 1
    
            dNet_Amt = rstERSLS1("NET_AMT")
    
            dTotNet_Amt = dTotNet_Amt + dNet_Amt
    
            response.write "<tr>"
                response.write "<td align=left width=50><font face='Arial' size=2>" & record & "</td>"
                response.write "<td align=left width=600 ><font face='Arial' size=2>" & rstERSLS1("PART") & "</td>"
                response.write "<td align=left width=100 ><font face='Arial' size=2>" & rstERSLS1("SERIALNO") & "</td>"
                response.write "<td align=right width=100 ><font face='Arial' size=2>" & pFormatDec(dNet_Amt,2) & "</td>"
            response.write "</tr>"
    
            rstERSLS1.movenext      
           '=== recordPerPage = 30     
           if record >= recordPerPage and not rstERSLS1.eof then
                record = 0
                sPage = sPage + 1
    
                response.write"</table>"
                response.write "<br/>"
                response.write "<font face='Arial' size=1>"
                response.Write"Continue Next Page..."    
                response.Write"<p style='page-break-before: always'></p>" 
    
                call pageHeader()
    
            elseif rstERSLS1.eof then
                '==== Fill the empty space and drag the footer to the bottom
                do until record >= recordPerPage 
                    record = record + 1
                        response.write "<td colspan=4 >&nbsp;&nbsp;</td>"
                    response.write "</tr>"
                loop
    
            end if
    
        Loop
        pCloseTables(rstERSLS1) 
    
        %>
    
    '==== Footer
    <table width="850">
        <tr>
            <td colspan=3 align=left width=700><font face="Arial" size=2>RINGGIT MALAYSIA : <%= ConvertCurrencyToEnglish(pFormatDec(dTotNet_Amt,2))%></td>
        </tr>
        <tr>
            <td colspan="5">
                <hr color=black style="margin-top:0px;margin-bottom:0px" size=1>
            </td>
        </tr>
    </table>
    <table width="850">
        <tr>
            <td colspan="3" align=left width=600><font face="Arial" size=2></font>E & OE</td>
            <td align=left width=100><font face="Arial" size=2><b>Total (RM) : </b></font></td>
            <td align=right width=100><font face="Arial" size=2><b>RM <%=pFormatDec(dTotNet_Amt,2)%></b></></font></td>
    
        </tr>
        <tr>
            <td colspan="3" align=left width=600></td>
            <td colspan="2">
                <hr color=black style="margin-top:0px;margin-bottom:0px" size=2>
            </td>   
        </tr>
        <tr>
            <td colspan="3"width=600></td>
            <td colspan=2 align=left width=100><font face="Arial" size=1>Lorry Number : </font></td>
        </tr>
        <tr>
            <td align=left width=250>______________________________</td>
            <td align=left width=50></td>
            <td align=left width=250>______________________________</td>
            <td colspan=2 align=left width=100><font face="Arial" size=1>Driver Signature : </font></td>
        </tr>
        <tr>
            <td align=left width=250><font face="Arial" size=2>&nbsp;&nbsp;&nbsp;&nbsp;AUTHORISED SIGNATURE(S)</font></td>
            <td align=left width=50></td>
            <td align=left width=250><font face="Arial" size=2>&nbsp;&nbsp;&nbsp;&nbsp;RECIPIENT'S CHOP & SIGNATURE</font></td>
            <td colspan="2" align="left" width=100><font face="Arial" size=1>Store Keeper: </font></td>
        </tr>
    </table>
    <p style='page-break-after: always'></p> '=== This doesn't work
    </center>
    </body>
    </html>
    

    总是空一页

    Always Page 2

    1 回复  |  直到 6 年前
        1
  •  0
  •   Hanz Cheah    6 年前

    设法用以下方法解决它

    <style type="text/css">
    
        html, body {
          margin: 0 !important; 
          padding: 0 !important;
    
        }
    </style>