日期:2014-05-18  浏览次数:20353 次

400分求打印、條形碼兩個問題
(本想出400分求代碼,可惜系統不讓。如果有滿意的會額外開貼送300分)
  求源碼,有的分享下,謝謝,如果論壇寫不下你也可以mail:cyz_9977@sina.com(附上你的論壇ID,我好給分)COPY的網上的請不要貼上來。
1.我的打印希望能用到CSS(本人一竅不通),不要把工具欄打出來,就是能控制哪些能打印,哪些不能打印。
2.條形碼我希望是Drawing的方法,而不是“|”這種東西的拼湊。謝謝!

------解决方案--------------------
可以看activerreport或fastreport等第三方组件应该可以的。
------解决方案--------------------
太难了,我不会。
接分...o(∩_∩)o...哈哈
------解决方案--------------------
题外话!好久没上来了,给你代码,你也不能套用上去啊!

1、打印的问题
a)对于2003或者2005可以使用
<object id="WebBrowser" classid="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2" height="0" width="0">
</object>
加CSS的方法来控制(后面会给部分实例代码)
b)对于2008,可以使用RDLC来做(这个是.net framework 3.5有的)有点类似水晶报表,一般的报表足够应付了。
c)使用WebBrowse的简单例子,注意Style里面的控制部分
HTML code
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default9.aspx.cs" Inherits="Default9" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Untitled Page</title>
    <style type="text/css">
    .tdp
    {
        border-top: 2 solid #000000;
        border-right:  2 solid #000000;
        border-bottom: 1 solid #000000;
        border-left:  1 solid #000000;
        border-collapse:collapse;
    }
    .tabp
    {
        border-top: 0 solid #ffffff;
        border-right:  0 solid #ffffff;
        border-bottom: 1 solid #000000;
        border-left:  1 solid #000000;
    }
    </style>
    <style media="print" type="text/css">
    .noprint{display:none;}
    .PageNext{page-break-after: always;}
    </style>
</head>
<body>
    <form id="form1" runat="server">
        <object id="WebBrowser" classid="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2" height="0"
            width="0">
        </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" />
        <table border="1" cellpadding="2" cellspacing="0" style="border-collapse: collapse;
            width: 500pt; height: 730pt;" bordercolor="#000000" align="center">
            <thead style="display: table-header-group">
                <tr style="font-weight: bold">
                    <td style="height: 23px">
                        This is my body</td>
                    <td style="height: 23px">
                        This is my body</td>
                    <td style="width: 110px; height: 23px">
                        This is my body</td>
                    <td style="height: 23px">
                        This is my body</td>
                    <td style="height: 23px">
                        This is my body</td>
                </tr>
            </thead>
            <tbody style="page-break-after: always;">
                <tr>