问题:
word在IE中打开,请问怎么打印

解决方案 »

  1.   

    你如果是调用本地word的方式打开可以直接对word进行打印
      

  2.   

    <script language="javascript" type="text/javascript">
    function preview()
    {
    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;
    window.document.body.style.backgroundColor = '#ffffff';
    //window.document.body.style.color = '#000000';
    window.print();
    }
        </script>
     <input type="button" name="print" value="预览并打印" onclick="preview()" />
      <!--startprint-->
    这里放你要打印的内容
      <!--endprint-->
      

  3.   

    我是的.CS代码如下
    using System;
    using System.Data;
    using System.Configuration;
    using System.Collections;
    using System.Web;
    using System.Web.Security;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Web.UI.WebControls.WebParts;
    using System.Web.UI.HtmlControls;
    using System.Text;
    using System.IO;
    using DocM.DocDll;
    using DocM.Commont;
    using eprintdll;
    public partial class DocM_fmdown : System.Web.UI.Page
    {
        FileA FM = new FileA();
        FileBLL fm = new FileBLL();
      
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {            try
                {
                    ArrayList drr = new ArrayList();
                    drr = FM.fmfilecont(Convert.ToInt32(Request.QueryString["fid"].ToString()));
                    string Phat = drr[0].ToString();
                    string[] http = Phat.Split('\\');
                    string realpath = http[1] + "/" + http[2];
                    string extented = http[2].Substring(http[2].LastIndexOf(".") + 1);
                    FileInfo myfile = new FileInfo(Server.MapPath(realpath));
                    Response.Clear();
                    Response.AddHeader("Content-Disposition", "filename=" + realpath + "");
                    Response.AddHeader("Content-Length", myfile.Length.ToString());
                    Response.ContentType = fm.doctype(extented);
                    Response.WriteFile(Server.MapPath(realpath));
                    Response.Flush();
                    Response.End();                //StreamReader sr = new StreamReader(Request.InputStream);
                    //string strXml = sr.ReadToEnd();
                    //string skey = Request.QueryString.ToString();
                    //eprintdll.PathFile pathfile = new eprintdll.PathFile(null, strXml,Request.PhysicalApplicationPath);                //string strReturn = pathfile.returnXml(skey);                //Response.Write(realpath);
                    
                }
                catch
                {
                    Jscript.Alert("数据有错");
                }
            }        
          
           
        }
    }