Dim tm As String = ProjectPath & "Attachments\标签.docx" '指定模板文件
Dim fl As String = ProjectPath & "Reports\标签.docx" '指定目标文件
Dim mg As String = ProjectPath & "Images\条码.gif" '约定的图片文件
Dim wrt As New WordReport(Tables("表A"),tm,fl) '定义一个WordReport
For Each r As Row In Tables("表A").Rows '逐行生成报表
Dim Bar As New BarCodeBuilder
Bar.Symbology = Barpro.Symbology.QRCode
Bar.Code = r("条码")
Bar.QuietZoneWidth = 2
Bar.HumanReadableText = r("条码")
Bar.Text = "测试信息"
Bar.TopMargin = 1
Bar.BottomMargin = 1
Bar.Font = New Font("微软雅黑",10.5,FontStyle.Bold)
Bar.TextFont = New Font("微软雅黑",13,FontStyle.Bold)
Bar.QRCodeModuleSize = 2
bar.SaveImage(mg)
wrt.BuildOne(r)
Next
wrt.Show()
请问 我想实现 指定打印机(名称为:条码打印机A)直接打印,以上代码怎么修改?
[此贴子已经被作者于2024/9/17 1:43:49编辑过]
保存报表然后退出,在使用vba处理:http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&Id=183409
……
wrt.BuildOne(r)
Next
wrt.Quit()
Dim app As New MSWord.Application
Try
app.ActivePrinter = "条码打印机A"
Dim doc = app.Documents.Open(fl)
doc.PrintOut(ManualDuplexPrint:=True)
doc.close()
app.quit()
Catch ex As Exception
MsgBox(ex.Message)
app.quit()
End Try
如果是打印预览的话 是不是将true改为 false呢
doc.PrintOut(ManualDuplexPrint:=True)
改为
doc.PrintOut(ManualDuplexPrint:=false)