var lblList = new List<product_LblPrt_tmp>(); using (JL_MFGEntities ctx = new JL_MFGEntities()) { lblList=ctx.product_LblPrt_tmp.ToList(); } var list = ServiceLocator.Fetch<IMaterialService>().GetList(); var rpt = new XtraReport3(); rpt.DataSource = lblList;// new List<Base_Material>() { list[0], list[1] }; rpt.RequestParameters = false; rpt.PrintingSystem.ShowMarginsWarning = false; rpt.PrintingSystem.ShowPrintStatusDialog = false; ReportPrintTool printTool = new ReportPrintTool(rpt); printTool.Report.CreateDocument(false); // Invoke the Ribbon Print Preview form modally, // and load the report document into it. printTool.PrintingSystem.ShowMarginsWarning = false; printTool.PrintingSystem.AddCommandHandler(new ExportToImageCommandHandler()); var v = printTool.PrintingSystem.GetCommandVisibility(PrintingSystemCommand.PageSetup); printTool.PrintingSystem.SetCommandVisibility(PrintingSystemCommand.PageSetup, CommandVisibility.None); printTool.PrintingSystem.ExecCommand(PrintingSystemCommand.ShowFirstPage); printTool.ShowPreview();
printTool.Report.CreateDocument(false);
printTool.PrintingSystem.ShowMarginsWarning = false;
两句一起可以避免边界超出提示
打印机属性设置页面大小后,
发现在ReportTool里的看到的打印机页面大小不一致。。
各种麻烦
东芝TEC
打印机放平,后面进纸卡槽锁死
感应器是传动式
打印机理设置标签配置User是 left Margin 1.27mm,左标签40mm,中间1.5mm,右标签40mm,Right Margin 1.27mm,标签高80mm,页面间2毫米
设置标签宽为 82mm,考虑中间的1.5mm
标签设计时将页面设置成 840, * 800, 2列,中间间距 15,这个时候在ReportTool里看到use页面设置正好是 81.6mm
(标签设计时的单位是TenthsOfAMillimeter,即10分之一毫米,所以要乘以10)
//使用documentView,XRPivotGrid的DataSource不等于report的DataSource
var rpt=new XtraReport1(); var sql=DRecAnalyze.LoadSql("sql05.txt"); sql=sql.Replace("$DCondition","").Replace("$TCondition",""); var ctl=rpt.FindControl("xrPivotGrid1", true) as XRPivotGrid; ctl.DataSource = DRecAnalyze.LoadData(sql); documentViewer1.DocumentSource = rpt;