using System; using System.Collections.Generic; using System.Drawing.Printing; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using TradeModel; namespace TradeManage.HuoWu { public partial class HW_GoodsPrint : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } protected void APrint_Click(object sender, EventArgs e) { //List gwplist = new List(); //if (Session["GoodWarePrint"] != null) // gwplist = (List)Session["GoodWarePrint"]; //ReportDocument rptSales = new CrystalDecisions.CrystalReports.Engine.ReportDocument(); //rptSales.FileName = Server.MapPath("../PrintTemplate/GoodBatch.rpt"); //rptSales.SetDataSource(gwplist); //PrintDocument prtdoc = new PrintDocument(); //string strDefaultPrinter = prtdoc.PrinterSettings.PrinterName; //// then print, this is the important thing here //rptSales.PrintOptions.PrinterName = strDefaultPrinter; //rptSales.PrintOptions.PaperSize = CrystalDecisions.Shared.PaperSize.DefaultPaperSize; //rptSales.PrintOptions.PaperSource = CrystalDecisions.Shared.PaperSource.Auto; ////parameters here depending on your situation. //rptSales.PrintToPrinter(1, true, 1, 9999); } public void ZPrint(List gwplist) { ////List gwplist = new List(); //if (Session["GoodWarePrint"] != null) // gwplist = (List)Session["GoodWarePrint"]; //ReportDocument rptSales = new CrystalDecisions.CrystalReports.Engine.ReportDocument(); //rptSales.FileName = Server.MapPath("../PrintTemplate/GoodBatch.rpt"); //rptSales.SetDataSource(gwplist); //PrintDocument prtdoc = new PrintDocument(); //string strDefaultPrinter = prtdoc.PrinterSettings.PrinterName; //// then print, this is the important thing here //rptSales.PrintOptions.PrinterName = strDefaultPrinter; //rptSales.PrintOptions.PaperSize = CrystalDecisions.Shared.PaperSize.DefaultPaperSize; //rptSales.PrintOptions.PaperSource = CrystalDecisions.Shared.PaperSource.Auto; ////parameters here depending on your situation. //rptSales.PrintToPrinter(1, true, 1, 9999); } } }