- Protected Sub Btn_chuli_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Btn_chuli.Click
- '对需要打印的条码进行预先处理
- Dim str As String = ""
- Dim num As Integer = DG_show.Rows.Count
- Dim top As Integer = 11 '每个边各余出4mm间隔
- Dim left As Integer = 3
- Dim jianju As Integer = 2
- Dim W1 As Integer = 63.5
- Dim H1 As Integer = 38.1
- Dim lineH As Integer = 8
- Dim lineW As Integer = 20
- Dim W2 As Integer = 43
- Dim W3 As Integer = 40 '条码的宽度
- Dim H3 As Integer = 14 '条码的高度
- Dim s2 As String = "部门"
- Dim s1 As String = "名称"
- Dim s3 As String = "购买日期"
- Dim bh, mc, sybm, zrr As String
- If num < 1 Or num > 21 Then
- Exit Sub
- End If
- str = "<script language='javascript' type='text/javascript'>"
- str += "function CreatePrintPage() { "
- str += "LODOP = getLodop(document.getElementById('LODOP_OB'), document.getElementById('LODOP_EM')); "
- str += "LODOP.PRINT_INIT('打印测试用的');"
- str += "LODOP.SET_PRINT_STYLE('FontSize', 10); "
- For i = 0 To num - 1
- bh = DG_show.DataKeys(i)(0)
- mc = DG_show.DataKeys(i)(1)
- sybm = DG_show.DataKeys(i)(2)
- zrr = DG_show.DataKeys(i)(3)
- '第一个框框
- If i = 0 Then
- str += "LODOP.ADD_PRINT_RECT('" & top & "mm', '" & left & "mm', '" & W1 & "mm','" & H1 & "mm', 0, 1); "
- str += "LODOP.ADD_PRINT_LINE('" & top + lineH & "mm','" & left & "mm','" & top + lineH & "mm','" & left + W1 & "mm',0,1);" '第一根直线
- str += "LODOP.ADD_PRINT_LINE('" & top + lineH * 2 & "mm','" & left & "mm','" & top + lineH * 2 & "mm','" & left + W1 & "mm',0,1);" '第二根直线
- str += "LODOP.ADD_PRINT_LINE('" & top + lineH * 3 & "mm','" & left & "mm','" & top + lineH * 3 & "mm','" & left + W1 & "mm',0,1);" '第三根直线
- str += "LODOP.ADD_PRINT_LINE('" & top & "mm','" & left + lineW & "mm','" & top + lineH * 3 & "mm','" & left + lineW & "mm',0,1);" '第一根竖线
- str += "LODOP.ADD_PRINT_TEXT('" & top + 2 & "mm','" & left - 2 & "mm','" & lineW & "mm','" & lineH & "mm','" & s1 & "');" '第一行第一列
- str += "LODOP.SET_PRINT_STYLEA(0,'Alignment',3);"
- str += "LODOP.ADD_PRINT_TEXT('" & top + lineH + 2 & "mm','" & left - 2 & "mm','" & lineW & "mm','" & lineH & "mm','" & s2 & "');" '第二行第一列
- str += "LODOP.SET_PRINT_STYLEA(0,'Alignment',3);"
- str += "LODOP.ADD_PRINT_TEXT('" & top + lineH * 2 + 2 & "mm','" & left - 2 & "mm','" & lineW & "mm','" & lineH & "mm','" & s3 & "');" '第三列第一称
- str += "LODOP.SET_PRINT_STYLEA(0,'Alignment',3);"
- str += "LODOP.ADD_PRINT_TEXT('" & top + 2 & "mm','" & left + lineW + 2 & "mm','" & W2 & "mm','" & lineH & "mm','" & mc & "');" '第一行第二列
- str += "LODOP.ADD_PRINT_TEXT('" & top + lineH + 2 & "mm','" & left + lineW + 2 & "mm','" & W2 & "mm','" & lineH & "mm','" & sybm & "');" '第二行 第二列
- str += "LODOP.ADD_PRINT_TEXT('" & top + lineH * 2 + 2 & "mm','" & left + lineW + 2 & "mm','" & W2 & "mm','" & lineH & "mm','" & zrr & "');" '第三行第二列
- str += "LODOP.ADD_PRINT_BARCODE('" & top + lineH * 3 + 2 & "mm','" & left + (W1 - W3) \ 2 & "mm','" & W3 & "mm','" & H3 - 4 & "mm','EAN128A','" & bh & "');" '第四行条形码列
- End If
- '第二个框框
- If i = 1 Then
- str += "LODOP.ADD_PRINT_RECT('" & top & "mm', '" & left + W1 + jianju & "mm', '" & W1 & "mm','" & H1 & "mm', 0, 1); "
- str += "LODOP.ADD_PRINT_LINE('" & top + lineH & "mm','" & left + W1 + jianju & "mm','" & top + lineH & "mm','" & left + W1 * 2 + jianju & "mm',0,1);" '第一根直线
- str += "LODOP.ADD_PRINT_LINE('" & top + lineH * 2 & "mm','" & left + W1 + jianju & "mm','" & top + lineH * 2 & "mm','" & left + W1 * 2 + jianju & "mm',0,1);" '第二根直线
- str += "LODOP.ADD_PRINT_LINE('" & top + lineH * 3 & "mm','" & left + W1 + jianju & "mm','" & top + lineH * 3 & "mm','" & left + W1 * 2 + jianju & "mm',0,1);" '第三根直线
- str += "LODOP.ADD_PRINT_LINE('" & top & "mm','" & left + lineW + W1 + jianju & "mm','" & top + lineH * 3 & "mm','" & left + lineW + W1 + jianju & "mm',0,1);" '第一根竖线
- str += "LODOP.ADD_PRINT_TEXT('" & top + 2 & "mm','" & left + W1 + jianju - 2 & "mm','" & lineW & "mm','" & lineH & "mm','" & s1 & "');" '第一行第一列
- str += "LODOP.SET_PRINT_STYLEA(0,'Alignment',3);"
- str += "LODOP.ADD_PRINT_TEXT('" & top + lineH + 2 & "mm','" & left + W1 + jianju - 2 & "mm','" & lineW & "mm','" & lineH & "mm','" & s2 & "');" '第二行第一列
- str += "LODOP.SET_PRINT_STYLEA(0,'Alignment',3);"
- str += "LODOP.ADD_PRINT_TEXT('" & top + lineH * 2 + 2 & "mm','" & left + W1 + jianju - 2 & "mm','" & lineW & "mm','" & lineH & "mm','" & s3 & "');" '第三列第一称
- str += "LODOP.SET_PRINT_STYLEA(0,'Alignment',3);"
- str += "LODOP.ADD_PRINT_TEXT('" & top + 2 & "mm','" & left + lineW + W1 + jianju + 2 & "mm','" & W2 & "mm','" & lineH & "mm','" & mc & "');" '第一行第二列
- str += "LODOP.ADD_PRINT_TEXT('" & top + lineH + 2 & "mm','" & left + lineW + W1 + jianju + 2 & "mm','" & W2 & "mm','" & lineH & "mm','" & sybm & "');" '第二行 第二列
- str += "LODOP.ADD_PRINT_TEXT('" & top + lineH * 2 + 2 & "mm','" & left + lineW + W1 + jianju + 2 & "mm','" & W2 & "mm','" & lineH & "mm','" & zrr & "');" '第三行第二列
- str += "LODOP.ADD_PRINT_BARCODE('" & top + lineH * 3 + 2 & "mm','" & left + W1 + jianju + (W1 - W3) \ 2 & "mm','" & W3 & "mm','" & H3 - 4 & "mm','EAN128A','" & bh & "');" '第四行条形码列
- End If
- '第三个框框
复制代码 |