vb中,关于做一个打印报表,怎么作阿?就是要把datagrid里面的数据给打印出来,还希望能打印预览。

解决方案 »

  1.   

    Response.ClearContent()       
    Response.AddHeader("content-disposition", "attachment; filename=MyExcelFile.xls")
    Response.ContentType = "application/excel"
    Response.ContentEncoding = System.Text.Encoding.GetEncoding("gb2312")
            dim sw as new StringWriter()
            dim htw as  new HtmlTextWriter(sw)
            GridView1.RenderControl(htw)
            Response.Write(sw.ToString())
            Response.End()
    没测试,你试下
    或者可否用帐票来打印,ActiveReport