遗忘海岸

江湖程序员 -Feiph(LM战士)

导航

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

统计

XtrasReport 标签打印

复制代码
            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();
View Code
复制代码

 

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;
View Code
复制代码

 

posted on   遗忘海岸  阅读(1544)  评论(0编辑  收藏  举报

编辑推荐:
· 如何编写易于单元测试的代码
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
阅读排行:
· 周边上新:园子的第一款马克杯温暖上架
· Open-Sora 2.0 重磅开源!
· .NET周刊【3月第1期 2025-03-02】
· 分享 3 个 .NET 开源的文件压缩处理库,助力快速实现文件压缩解压功能!
· [AI/GPT/综述] AI Agent的设计模式综述
历史上的今天:
2011-10-25 关于Persist Security Info=True,又遇sa登陆失败的错误
2011-10-25 将Excel的数据库字典导到PDM中
点击右上角即可分享
微信分享提示