老师好,下面是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()