以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- [求助]条码打印 (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=178864) |
-- 作者:江南小镇 -- 发布时间:2022/7/25 7:28:00 -- [求助]条码打印 老师好,下面是Excel报表事件,我想直接打印“条码管理表”不打印父,另一组是按钮事件。两组代码不知怎样修改。谢谢老师。 If e.Book.TempLate = "模板" Then If e.region = "条码管理" Then 老师,能换成打印窗口表吗? If e.DataRow Is Nothing OrElse e.DataRow.IsNull("条码一") Then \'如果是空行或者Lot列为空 Dim img As New System.Drawing.Bitmap(1,1) \'生成一个空白图片 img.Save(ProjectPath & "Images\\BarCode.gif") Else \'否则生成条形码图片 Dim Bar As New BarCodeBuilder Bar.Symbology = Barpro.Symbology.Ean13 Bar.Code = e.DataRow("条码一") Bar.BarRatio = 0.3 Bar.BarHeight = 8 bar.SaveImage(ProjectPath & "Images\\BarCode.gif",300) End If If e.DataRow Is Nothing OrElse e.DataRow.IsNull("条码二") Then \'如果是空行或者Lot列为空 Dim img As New System.Drawing.Bitmap(1,1) \'生成一个空白图片 img.Save(ProjectPath & "Images\\BarCode1.gif") Else \'否则生成条形码图片 Dim Bar As New BarCodeBuilder Bar.Symbology = Barpro.Symbology.Ean13 Bar.Code = e.DataRow("条码二") Bar.BarRatio = 0.3 Bar.BarHeight = 8 bar.SaveImage(ProjectPath & "Images\\BarCode1.gif",300) End If If e.DataRow Is Nothing OrElse e.DataRow.IsNull("条码三") Then \'如果是空行或者Lot列为空 Dim img As New System.Drawing.Bitmap(1,1) \'生成一个空白图片 img.Save(ProjectPath & "Images\\BarCode2.gif") Else \'否则生成条形码图片 Dim Bar As New BarCodeBuilder Bar.Symbology = Barpro.Symbology.Ean13 Bar.Code = e.DataRow("条码三") Bar.BarRatio = 0.3 Bar.BarHeight = 8 bar.SaveImage(ProjectPath & "Images\\BarCode2.gif",300) End If End If End If 下面是按钮代码 Dim Book As New XLS.Book(ProjectPath & "Attachments\\模板.xls") Dim fl As String = ProjectPath & "Reports\\模板.xls" Book.Build() \'生成细节区 Book.Save(fl) \'保存工作簿 Dim Proc As New Process \'打开工作簿 Proc.File = fl Proc.Start() |
-- 作者:有点蓝 -- 发布时间:2022/7/25 8:43:00 -- 参考:http://www.foxtable.com/webhelp/topics/2627.htm |
-- 作者:江南小镇 -- 发布时间:2022/7/27 6:07:00 -- 老师好,打印条形码报错,去掉标出的代码就好了。 If e.Book.TempLate = "模板" Then If e.region = "条码管理" Then If e.DataRow Is Nothing OrElse e.DataRow.IsNull("条码一") Then \'如果是空行或者Lot列为空 Dim img As New System.Drawing.Bitmap(1,1) \'生成一个空白图片 img.Save(ProjectPath & "Images\\BarCode.gif") Else \'否则生成条形码图片 Dim Bar As New BarCodeBuilder Bar.Symbology = Barpro.Symbology.Ean13 Bar.Code = e.DataRow("条码一") Bar.BarRatio = 0.3 Bar.BarHeight = 8 bar.SaveImage(ProjectPath & "Images\\BarCode.gif",300) End If If e.DataRow Is Nothing OrElse e.DataRow.IsNull("条码二") Then \'如果是空行或者Lot列为空 Dim img As New System.Drawing.Bitmap(1,1) \'生成一个空白图片 img.Save(ProjectPath & "Images\\BarCode1.gif") Else \'否则生成条形码图片 Dim Bar As New BarCodeBuilder Bar.Symbology = Barpro.Symbology.Ean13 Bar.Code = e.DataRow("条码二") Bar.BarRatio = 0.3 Bar.BarHeight = 8 bar.SaveImage(ProjectPath & "Images\\BarCode1.gif",300) End If If e.DataRow Is Nothing OrElse e.DataRow.IsNull("条码三") Then \'如果是空行或者Lot列为空 Dim img As New System.Drawing.Bitmap(1,1) \'生成一个空白图片 img.Save(ProjectPath & "Images\\BarCode2.gif") Else \'否则生成条形码图片 Dim Bar As New BarCodeBuilder Bar.Symbology = Barpro.Symbology.Ean13 Bar.Code = e.DataRow("条码三") Bar.BarRatio = 0.3 Bar.BarHeight = 8 bar.SaveImage(ProjectPath & "Images\\BarCode2.gif",300) End If End If End If 第二行重复了第一行的条形码图 |
-- 作者:有点蓝 -- 发布时间:2022/7/27 8:45:00 -- 应该是第二行条码二没有值,或者是一个空字符串,或者是一个不符合ean13规则的条码数据 |