asp.net中的“按需打印”(打印你需要打印的部分(3)


                    <tr>
                        <td nowrap="nowrap">诉求所在地域:</td>
                        <td colspan="3"><asp:Label runat="server" Text=""></asp:Label></td>
                    </tr>
                    <tr>
                        <td colspan="4"><asp:Label runat="server" Text=""/></td>
                    </tr>
                    <tr>
                        <td colspan="4" valign="top" nowrap="nowrap">诉求内容:</td>
                    </tr>
                    <tr>
                        <td colspan="4" valign="top">
                            <pe:ExtendedLiteral runat="server" HtmlEncode="false"/>
                        </td>
                    </tr>
                </tbody>
            </table>
            </td>
        </tr>
    </tbody>
</table>
<!--endprint-->
   <br />
    <div>
        <input type="button" value="打 印…" />
    </div>
    <br />
 <script type="text/javascript">

<!--

function doPrint(){
        bdhtml = window.document.body.innerHTML;
        sprnstr = "<!--startprint-->";
        eprnstr = "<!--endprint-->";
        prnhtml = bdhtml.substr(bdhtml.indexOf(sprnstr) + 17);
        prnhtml = prnhtml.substring(0, prnhtml.indexOf(eprnstr));
        window.document.body.innerHTML =  prnhtml;
        var obj = window.document.body;
        doZoom(obj, 18); //放大打印
        window.print();
    }

function doZoom(artibody, size) {
        if (!artibody)
        {
          return;
        }
          setChildNodesByCurrentNode(artibody,size);
    }

function setChildNodesByCurrentNode(node,size) {
        for(var i=0; i < node.childNodes.length; i++) {
            var artibodyChild = node.childNodes[i];
            if (artibodyChild.nodeType == 1) {
                artibodyChild.className="";
                artibodyChild.style.fontSize = size + 'px';
                artibodyChild.style.fontFamily = '仿宋_GB2312,宋体,"Times New Roman",Georgia,serif';
                artibodyChild.style.fontWeight = 900;
                if(artibodyChild.childNodes.length>0) {
                    setChildNodesByCurrentNode(artibodyChild,size);
                }
            }
         }
      }

-->

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wjgffz.html