Foxtable(狐表)用户栏目专家坐堂 → 利用sqltable生成的表,怎么调用生成二维码呢?之前直接采用table可以生成,现在改成SQLTABLE之后无法生成了,是不是哪里出错了?


  共有2057人关注过本帖平板打印复制链接

主题:利用sqltable生成的表,怎么调用生成二维码呢?之前直接采用table可以生成,现在改成SQLTABLE之后无法生成了,是不是哪里出错了?

帅哥哟,离线,有人找我吗?
李孝春
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:九尾狐 帖子:2472 积分:17346 威望:0 精华:0 注册:2013/1/31 0:03:00
利用sqltable生成的表,怎么调用生成二维码呢?之前直接采用table可以生成,现在改成SQLTABLE之后无法生成了,是不是哪里出错了?  发帖心情 Post By:2018/3/13 11:51:00 [只看该作者]

红色部分是原来代码
卷宗入库_Table1  对应卷宗入库
卷宗入库_Table2  对应入库明细
下述代码运行后提示错误为:
.NET Framework 版本:2.0.50727.8762
Foxtable 版本:2018.3.9.1
错误所在事件:窗口,卷宗入库,Button3,Click
详细错误信息:
未将对象引用设置到对象的实例。



If Tables("卷宗入库_Table1").Current IsNot Nothing Then
    Tables("卷宗入库_Table2").Filter = "卷宗编号 = '" & Tables("卷宗入库_Table1").Current("卷宗编号") & "'"
If Tables("卷宗入库").Current IsNot Nothing Then
    Tables("入库明细").Filter = "卷宗编号 = '" & Tables("卷宗入库").Current("卷宗编号") & "'"

    Dim doc As New PrintDoc
    Dim rg As prt.RenderGraphics
    Dim Bar As New BarCodeBuilder
    Dim dr As Row=Tables("打印机").Current
    doc.PageSetting.Width = val(dr("设置宽度"))
    doc.PageSetting.Height = val(dr("设置高度") )
    doc.PageSetting.LeftMargin=val(dr("左边距") )
    doc.PageSetting.RightMargin=val(dr("右边距") )
    doc.PageSetting.TopMargin=val(dr("上边距") )
    doc.PageSetting.BottomMargin=val(dr("下边距") )
    Doc.PrinterName = dr("打印机名称")
    'Dim xz As String = dr("是否旋转")
    doc.AutoRotate = dr("是否旋转")
    doc.PageSetting.Landscape=dr("是否横向")
    Bar.Symbology = Barpro.Symbology.QRCode
    Doc.Stacking = prt.StackingRulesEnum.InlineLeftToRight
    For Each r As Row In Tables("卷宗入库_Table2").Rows
    For Each r As Row In Tables(入库明细").Rows
        bar.Text=r("分册编号") & "册"
        bar.Code = r("加密字符")
        rg = new prt.RenderGraphics
        bar.DrawOnCanvas(rg.Graphics,0,0, val(dr("缩放比例") ))
        rg.Style.Spacing.All = 1
        Doc.Body.Children.Add(rg)
        bar.SaveImage(ProjectPath & "Reports\卷宗二维码\" & r("卷宗编号") & r("分册编号") & "二维码.jpg")
        r("二维码")=ProjectPath & "Reports\卷宗二维码\" & r("卷宗编号") & r("分册编号") & "二维码.jpg"
        'r.DataRow.SQLInsertFile("图片",ProjectPath & "Reports\卷宗二维码\" & r("卷宗编号") & r("分册编号") & "二维码.jpg")
        'r.Save
        'If r("图片") IsNot Nothing Then
        'If FileSys.FileExists(ProjectPath & "Reports\" & r("卷宗编号") & r("分册编号") & "二维码.jpg") Then '如果指定的文件存在
        'FileSys.DeleteFile(ProjectPath & "Reports\" & r("卷宗编号") & r("分册编号") & "二维码.jpg",2,2) '则彻底删除之
        'End If
        'End If
    Next
    Dim r1 As WinForm.RadioButton = e.Form.Controls("RadioButton1")
    Dim r2 As WinForm.RadioButton = e.Form.Controls("RadioButton2")
    If r1.Checked=True Then
        Doc.Preview()
    Else
        If r2.Checked=True Then
            Doc.Print()
        Else
            MessageBox.Show("请选择预览或者直打!")
        End If
    End If
End If
[此贴子已经被作者于2018/3/13 11:54:57编辑过]

 回到顶部