Foxtable(狐表)用户栏目专家坐堂 → 点选下拉列表选项后,其他控件未定现自动录入数据


  共有2952人关注过本帖树形打印复制链接

主题:点选下拉列表选项后,其他控件未定现自动录入数据

美女呀,离线,留言给我吧!
采菊东篱下
  31楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:八尾狐 帖子:1881 积分:10368 威望:0 精华:0 注册:2019/4/6 8:45:00
  发帖心情 Post By:2021/11/6 17:21:00 [只看该作者]

论坛回复中的上传图片,第一次上传肯定说错,第二次上传才成功,昨天发现每次都这样。

 回到顶部
帅哥哟,离线,有人找我吗?
有点蓝
  32楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:106067 积分:539428 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2021/11/6 17:26:00 [只看该作者]

论坛比较老了,暂时没有办法。习惯就好图片点击可在新窗口打开查看

 回到顶部
帅哥哟,离线,有人找我吗?
有点蓝
  33楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:106067 积分:539428 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2021/11/6 17:29:00 [只看该作者]


 回到顶部
美女呀,离线,留言给我吧!
采菊东篱下
  34楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:八尾狐 帖子:1881 积分:10368 威望:0 精华:0 注册:2019/4/6 8:45:00
  发帖心情 Post By:2021/11/6 21:48:00 [只看该作者]

这样写弹出:

图片点击可在新窗口打开查看此主题相关图片如下:qq图片20211106214355.png
图片点击可在新窗口打开查看
选文字(如小五、小四)字号报错,选数字字号没问题,但系统中存在这种字号,怎么我在窗口中
用组合框选就不行了?


Dim doc As New PrintDoc '定义一个报表
doc.Stacking = prt.StackingRulesEnum.InlineLeftToRight '设置排列方式
If e.Form.Controls("TextBox4").Value Is Nothing OrElse e.Form.Controls("TextBox5").Value Is Nothing Then
    messagebox.show("模板长宽不能为空")
    Return
End If
If e.Form.Controls("RadioButton1").Checked = True And e.Form.Controls("ComboBox1").text = e.form.controls("combobox1").items(0) Then
    doc.PageSetting.Width = 297 'A3纸张宽度,单位为毫米
    doc.PageSetting.Height = 420  'A3纸张高度,单位为毫米
ElseIf e.Form.Controls("RadioButton2").Checked = True And e.Form.Controls("ComboBox1").text = e.form.controls("combobox1").items(1) Then
    doc.PageSetting.Width = 210 'A4纸张宽度,单位为毫米
    doc.PageSetting.Height = 297  'A4纸张高度,单位为毫米
ElseIf e.Form.Controls("RadioButton2").Checked = True And e.Form.Controls("ComboBox1").text = e.form.controls("combobox1").items(2) Then
    doc.PageSetting.Width = 148.5 'A5纸张宽度,单位为毫米
    doc.PageSetting.Height = 210  'A5纸张高度,单位为毫米
ElseIf e.Form.Controls("RadioButton2").Checked = True And e.Form.Controls("ComboBox1").text = e.form.controls("combobox1").items(3) Then
    doc.PageSetting.Width = 257 'B4纸张宽度,单位为毫米
    doc.PageSetting.Height = 364  'B4纸张高度,单位为毫米
ElseIf e.Form.Controls("RadioButton2").Checked = True And e.Form.Controls("ComboBox1").text = e.form.controls("combobox1").items(4) Then
    doc.PageSetting.Width = 176 'B5纸张宽度,单位为毫米
    doc.PageSetting.Height = 250  'B5纸张高度,单位为毫米
ElseIf e.Form.Controls("RadioButton2").Checked = True And e.Form.Controls("ComboBox1").text = e.form.controls("combobox1").items(5) Then
    doc.PageSetting.Width = 420 'A2纸张宽度,单位为毫米
    doc.PageSetting.Height = 594  'A2纸张高度,单位为毫米
ElseIf e.Form.Controls("RadioButton2").Checked = True And e.Form.Controls("ComboBox1").text = e.form.controls("combobox1").items(6) Then
    doc.PageSetting.Width = 105 'A6纸张宽度,单位为毫米
    doc.PageSetting.Height = 148  'A6纸张高度,单位为毫米
ElseIf e.Form.Controls("RadioButton1").Checked = True And e.Form.Controls("TextBox1").text IsNot Nothing And e.Form.Controls("TextBox2").text IsNot Nothing Then
    doc.PageSetting.Width = Val(e.Form.Controls("TextBox2").Value) '自定义纸张宽度,单位为毫米
    doc.PageSetting.Height = Val(e.Form.Controls("TextBox1").Value)  '自定义纸张高度,单位为毫米
Else
    messagebox.show("纸张规格不能为空")
    Return
End If
If e.Form.Controls("ComboBox2").Value Is Nothing Then
    messagebox.show("棋赛名称不能为空")
    Return
End If
Dim c1 As Double = e.Form.Controls("TextBox4").Value
Dim c2 As Double = e.Form.Controls("TextBox5").Value
Dim c3 As Double = Val(doc.PageSetting.Width)
Dim c4 As Double = Val(doc.PageSetting.Height)
Doc.PageSetting.LeftMargin = (c3 - c1*(Math.Floor(c3/c1)))/2 '设置左边距
Doc.PageSetting.RightMargin = (c3 - c1*(Math.Floor(c3/c1)))/2 '设置右边距
Doc.PageSetting.TopMargin = (c4 - c2*(Math.Floor(c4/c2)))/2 '设置上边距
Doc.PageSetting.BottomMargin = (c4 - c2*(Math.Floor(c4/c2)))/2 '设置下边距
Dim Min0 As String = DataTables("基本信息").SQLCompute("Min(编号)","[棋赛名称] = '" & e.Form.Controls("ComboBox2").text & "'")
For i As Integer = 1 To DataTables("基本信息").SQLCompute("Count(姓名)","[棋赛名称] = '" & e.Form.Controls("ComboBox2").text & "'")
    Dim rt As New prt.RenderTable() '定义一个表格对象
    Dim dr As DataRow = DataTables("基本信息").SQLFind("[棋赛名称] = '" & e.Form.Controls("ComboBox2").text & "' And [编号] = '" & Min0 & "'")
    If dr IsNot Nothing Then
        rt.Style.GridLines.All = New prt.LineDef '将网格线类型设为默认类型
        rt.Style.GridLines.Horz = new Prt.LineDef(Color.white)
        rt.Style.GridLines.Vert = new Prt.LineDef(Color.white)
        rt.Width = c1 '表格宽度为
        rt.Height = c2
        rt.Style.Spacing.All = 2 '和其他对象之间的间隔为2mm
        rt.SplitVertBehavior = prt.SplitBehaviorEnum.Never '避免垂直换页的时候,表格被分割成两部分.
        rt.Rows.Count = 8 '设置总行数
        rt.Cols.Count = 7 '设置总列数
        rt.Rows(0).Height = 7
        rt.Cols(0).Width = 3
        rt.cells(0,0).SpanCols = 7
        rt.cells(1,1).SpanCols = 5
        rt.Rows(1).Height = 10
        rt.Cells(1,1).Style.FontBold = True
        rt.Cells(1,1).Style.FontName = e.Form.Controls("FontPicker1").Value
        rt.Cells(1,1).Style.FontSize = e.Form.Controls("ComboBox3").Value
        rt.cells(1,1).Text = e.Form.Controls("ComboBox2").text
        rt.cells(1,1).Style.TextAlignHorz = prt.AlignHorzEnum.Center
        rt.cells(1,1).Style.TextAlignVert = prt.AlignHorzEnum.Center
        rt.Cells(2,1).SpanCols = 5
        If dr("棋赛副名") = Nothing Then
            rt.Cells(2,1).Text = Nothing
            rt.Rows(2).Height = 0
        Else
            rt.Cells(2,1).Text = dr("棋赛副名")
        End If
        rt.Cells(2,1).Style.FontName = e.Form.Controls("FontPicker2").Value
        rt.Cells(2,1).Style.FontSize = e.Form.Controls("ComboBox4").Value
        rt.Cells(2,1).Style.TextAlignHorz = prt.AlignHorzEnum.Center
        rt.cells(2,1).Style.TextAlignVert = prt.AlignHorzEnum.Center
        rt.Rows(3).Height = 2
        rt.Cols(3).Width = 37
        rt.Rows(4).Height = 30
        rt.Cells(4,3).Text = dr("编号")
        rt.Cells(4,3).Style.FontName = e.Form.Controls("FontPicker3").Value
        rt.Cells(4,3).Style.FontSize = e.Form.Controls("ComboBox5").Value
        rt.Cells(4,3).Style.TextAlignHorz = prt.AlignHorzEnum.Center
        rt.cells(4,3).Style.TextAlignVert = prt.AlignHorzEnum.Center
        rt.Rows(5).Height = 2
        rt.cells(6,2).SpanCols = 3
        rt.Cells(6,2).Text= dr("姓名")
        rt.Cells(6,2).Style.FontName = e.Form.Controls("FontPicker4").Value
        rt.Cells(6,2).Style.FontSize = e.Form.Controls("ComboBox6").Value
        rt.Cells(6,2).Style.TextAlignHorz = prt.AlignHorzEnum.Center
        rt.cells(6,2).Style.TextAlignVert = prt.AlignHorzEnum.Center
        rt.cells(7,0).SpanCols = 7
        rt.Rows(7).Height = 7
        rt.Cols(6).Width = 3
    ElseIf dr.IsNull("编号") Then
        Continue For
    End If
    doc.Body.Children.Add(rt) '将表格对象加入到报表中
    Min0 = CStr(CInt(Min0) + 1)
Next
'Dim rep As New prt.RenderEmpty '定义一个新的空对象
'rep.BreakBefore = prt.BreakEnum.Page '打印前换页
'doc.Body.Children.Add(rep )
Doc.Preview() '预览报表
[此贴子已经被作者于2021/11/7 15:27:33编辑过]

 回到顶部
美女呀,离线,留言给我吧!
采菊东篱下
  35楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:八尾狐 帖子:1881 积分:10368 威望:0 精华:0 注册:2019/4/6 8:45:00
  发帖心情 Post By:2021/11/7 12:27:00 [只看该作者]

 下载信息  [文件大小:   下载次数: ]
图片点击可在新窗口打开查看点击浏览该文件:排版.foxdb


图片点击可在新窗口打开查看此主题相关图片如下:qq图片20211107121751.png
图片点击可在新窗口打开查看
1、组合框中的字号为中文报错。
2、如果编号为空,希望跳过此号执行下一个循环,让排号紧贴不为空,红色标注的代码直接终止了后面数据显示不是我要的结果,不要红色代码,就出现图上的排列。
3、现在无法实现换页连打,显示所有数据,共有13个符合条件数据,因为要换页,没了后面的数据显示,在最后加上红色代码,第二页只显示空页没数据。
[此贴子已经被作者于2021/11/7 15:33:11编辑过]

 回到顶部
美女呀,离线,留言给我吧!
采菊东篱下
  36楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:八尾狐 帖子:1881 积分:10368 威望:0 精华:0 注册:2019/4/6 8:45:00
  发帖心情 Post By:2021/11/7 15:54:00 [只看该作者]

改为这样报错,红色标注代码表示换页:
.NET Framework 版本:4.0.30319.18063
Foxtable 版本:2021.11.4.1
错误所在事件:窗口,胸牌排版,Button1,Click
详细错误信息:
Object reference not set to an instance of an object.



Dim doc As New PrintDoc '定义一个报表
doc.Stacking = prt.StackingRulesEnum.InlineLeftToRight '设置排列方式
If e.Form.Controls("TextBox4").Value Is Nothing OrElse e.Form.Controls("TextBox5").Value Is Nothing Then
    messagebox.show("模板长宽不能为空")
    Return
End If
If e.Form.Controls("RadioButton1").Checked = True And e.Form.Controls("ComboBox1").text = e.form.controls("combobox1").items(0) Then
    doc.PageSetting.Width = 297 'A3纸张宽度,单位为毫米
    doc.PageSetting.Height = 420  'A3纸张高度,单位为毫米
ElseIf e.Form.Controls("RadioButton2").Checked = True And e.Form.Controls("ComboBox1").text = e.form.controls("combobox1").items(1) Then
    doc.PageSetting.Width = 210 'A4纸张宽度,单位为毫米
    doc.PageSetting.Height = 297  'A4纸张高度,单位为毫米
ElseIf e.Form.Controls("RadioButton2").Checked = True And e.Form.Controls("ComboBox1").text = e.form.controls("combobox1").items(2) Then
    doc.PageSetting.Width = 148.5 'A5纸张宽度,单位为毫米
    doc.PageSetting.Height = 210  'A5纸张高度,单位为毫米
ElseIf e.Form.Controls("RadioButton2").Checked = True And e.Form.Controls("ComboBox1").text = e.form.controls("combobox1").items(3) Then
    doc.PageSetting.Width = 257 'B4纸张宽度,单位为毫米
    doc.PageSetting.Height = 364  'B4纸张高度,单位为毫米
ElseIf e.Form.Controls("RadioButton2").Checked = True And e.Form.Controls("ComboBox1").text = e.form.controls("combobox1").items(4) Then
    doc.PageSetting.Width = 176 'B5纸张宽度,单位为毫米
    doc.PageSetting.Height = 250  'B5纸张高度,单位为毫米
ElseIf e.Form.Controls("RadioButton2").Checked = True And e.Form.Controls("ComboBox1").text = e.form.controls("combobox1").items(5) Then
    doc.PageSetting.Width = 420 'A2纸张宽度,单位为毫米
    doc.PageSetting.Height = 594  'A2纸张高度,单位为毫米
ElseIf e.Form.Controls("RadioButton2").Checked = True And e.Form.Controls("ComboBox1").text = e.form.controls("combobox1").items(6) Then
    doc.PageSetting.Width = 105 'A6纸张宽度,单位为毫米
    doc.PageSetting.Height = 148  'A6纸张高度,单位为毫米
ElseIf e.Form.Controls("RadioButton1").Checked = True And e.Form.Controls("TextBox1").text IsNot Nothing And e.Form.Controls("TextBox2").text IsNot Nothing Then
    doc.PageSetting.Width = Val(e.Form.Controls("TextBox2").Value) '自定义纸张宽度,单位为毫米
    doc.PageSetting.Height = Val(e.Form.Controls("TextBox1").Value)  '自定义纸张高度,单位为毫米
Else
    messagebox.show("纸张规格不能为空")
    Return
End If
If e.Form.Controls("ComboBox2").Value Is Nothing Then
    messagebox.show("棋赛名称不能为空")
    Return
End If
Dim c1 As Double = e.Form.Controls("TextBox4").Value
Dim c2 As Double = e.Form.Controls("TextBox5").Value
Dim c3 As Double = Val(doc.PageSetting.Width)
Dim c4 As Double = Val(doc.PageSetting.Height)
Doc.PageSetting.LeftMargin = (c3 - c1*(Math.Floor(c3/c1)))/2 '设置左边距
Doc.PageSetting.RightMargin = (c3 - c1*(Math.Floor(c3/c1)))/2 '设置右边距
Doc.PageSetting.TopMargin = (c4 - c2*(Math.Floor(c4/c2)))/2 '设置上边距
Doc.PageSetting.BottomMargin = (c4 - c2*(Math.Floor(c4/c2)))/2 '设置下边距
Dim Min0 As String = DataTables("基本信息").SQLCompute("Min(编号)","[棋赛名称] = '" & e.Form.Controls("ComboBox2").text & "'")
For n As Integer = 1 To DataTables("基本信息").SQLCompute("Count(姓名)","[棋赛名称] = '" & e.Form.Controls("ComboBox2").text & "'")/((Math.Floor(c3/c1)) * (Math.Floor(c4/c2)))
    Dim rep As New prt.RenderEmpty '定义一个新的空对象
    rep.BreakBefore = prt.BreakEnum.Page '打印前换页
    doc.Body.Children.Add(rep )
    For i As Integer = 1 To DataTables("基本信息").SQLCompute("Count(姓名)","[棋赛名称] = '" & e.Form.Controls("ComboBox2").text & "'")
        Dim rt As New prt.RenderTable() '定义一个表格对象
        Dim dr As DataRow = DataTables("基本信息").SQLFind("[棋赛名称] = '" & e.Form.Controls("ComboBox2").text & "' And [编号] = '" & Min0 & "'")
        If dr IsNot Nothing Then
            rt.Style.GridLines.All = New prt.LineDef '将网格线类型设为默认类型
            rt.Style.GridLines.Horz = new Prt.LineDef(Color.white)
            rt.Style.GridLines.Vert = new Prt.LineDef(Color.white)
            rt.Width = c1 '表格宽度为
            rt.Height = c2
            rt.Style.Spacing.All = 2 '和其他对象之间的间隔为2mm
            rt.SplitVertBehavior = prt.SplitBehaviorEnum.Never '避免垂直换页的时候,表格被分割成两部分.
            rt.Rows.Count = 8 '设置总行数
            rt.Cols.Count = 7 '设置总列数
            rt.Rows(0).Height = 7
            rt.Cols(0).Width = 3
            rt.cells(0,0).SpanCols = 7
            rt.cells(1,1).SpanCols = 5
            rt.Rows(1).Height = 10
            rt.Cells(1,1).Style.FontBold = True
            rt.Cells(1,1).Style.FontName = e.Form.Controls("FontPicker1").Value
            rt.Cells(1,1).Style.FontSize = e.Form.Controls("ComboBox3").Value
            rt.cells(1,1).Text = e.Form.Controls("ComboBox2").text
            rt.cells(1,1).Style.TextAlignHorz = prt.AlignHorzEnum.Center
            rt.cells(1,1).Style.TextAlignVert = prt.AlignHorzEnum.Center
            rt.Cells(2,1).SpanCols = 5
            If dr("棋赛副名") = Nothing Then
                rt.Cells(2,1).Text = Nothing
                rt.Rows(2).Height = 0
            Else
                rt.Cells(2,1).Text = dr("棋赛副名")
            End If
            rt.Cells(2,1).Style.FontName = e.Form.Controls("FontPicker2").Value
            rt.Cells(2,1).Style.FontSize = e.Form.Controls("ComboBox4").Value
            rt.Cells(2,1).Style.TextAlignHorz = prt.AlignHorzEnum.Center
            rt.cells(2,1).Style.TextAlignVert = prt.AlignHorzEnum.Center
            rt.Rows(3).Height = 2
            rt.Cols(3).Width = 37
            rt.Rows(4).Height = 30
            rt.Cells(4,3).Text = dr("编号")
            rt.Cells(4,3).Style.FontName = e.Form.Controls("FontPicker3").Value
            rt.Cells(4,3).Style.FontSize = e.Form.Controls("ComboBox5").Value
            rt.Cells(4,3).Style.TextAlignHorz = prt.AlignHorzEnum.Center
            rt.cells(4,3).Style.TextAlignVert = prt.AlignHorzEnum.Center
            rt.Rows(5).Height = 2
            rt.cells(6,2).SpanCols = 3
            rt.Cells(6,2).Text= dr("姓名")
            rt.Cells(6,2).Style.FontName = e.Form.Controls("FontPicker4").Value
            rt.Cells(6,2).Style.FontSize = e.Form.Controls("ComboBox6").Value
            rt.Cells(6,2).Style.TextAlignHorz = prt.AlignHorzEnum.Center
            rt.cells(6,2).Style.TextAlignVert = prt.AlignHorzEnum.Center
            rt.cells(7,0).SpanCols = 7
            rt.Rows(7).Height = 7
            rt.Cols(6).Width = 3
        ElseIf dr.IsNull("编号") Then
            Continue For
        End If
        doc.Body.Children.Add(rt) '将表格对象加入到报表中
        Min0 = CStr(CInt(Min0) + 1)
    Next
Next
Doc.Preview() '预览报表

 回到顶部
美女呀,离线,留言给我吧!
采菊东篱下
  37楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:八尾狐 帖子:1881 积分:10368 威望:0 精华:0 注册:2019/4/6 8:45:00
  发帖心情 Post By:2021/11/7 20:03:00 [只看该作者]

这段代码没有棋赛副名没问题,有棋赛副名就报错了:
.NET Framework 版本:4.0.30319.18063
Foxtable 版本:2021.11.4.1
错误所在事件:窗口,胸牌排版,Button1,Click
详细错误信息:
Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index


图片点击可在新窗口打开查看此主题相关图片如下:qq图片20211107200142.png
图片点击可在新窗口打开查看


Dim doc As New PrintDoc '定义一个报表
doc.Stacking = prt.StackingRulesEnum.InlineLeftToRight '设置排列方式
If e.Form.Controls("TextBox4").Value Is Nothing OrElse e.Form.Controls("TextBox5").Value Is Nothing Then
    messagebox.show("模板长宽不能为空")
    Return
End If
If e.Form.Controls("RadioButton1").Checked = True And e.Form.Controls("ComboBox1").text = e.form.controls("combobox1").items(0) Then
    doc.PageSetting.Width = 297 'A3纸张宽度,单位为毫米
    doc.PageSetting.Height = 420  'A3纸张高度,单位为毫米
ElseIf e.Form.Controls("RadioButton2").Checked = True And e.Form.Controls("ComboBox1").text = e.form.controls("combobox1").items(1) Then
    doc.PageSetting.Width = 210 'A4纸张宽度,单位为毫米
    doc.PageSetting.Height = 297  'A4纸张高度,单位为毫米
ElseIf e.Form.Controls("RadioButton2").Checked = True And e.Form.Controls("ComboBox1").text = e.form.controls("combobox1").items(2) Then
    doc.PageSetting.Width = 148.5 'A5纸张宽度,单位为毫米
    doc.PageSetting.Height = 210  'A5纸张高度,单位为毫米
ElseIf e.Form.Controls("RadioButton2").Checked = True And e.Form.Controls("ComboBox1").text = e.form.controls("combobox1").items(3) Then
    doc.PageSetting.Width = 257 'B4纸张宽度,单位为毫米
    doc.PageSetting.Height = 364  'B4纸张高度,单位为毫米
ElseIf e.Form.Controls("RadioButton2").Checked = True And e.Form.Controls("ComboBox1").text = e.form.controls("combobox1").items(4) Then
    doc.PageSetting.Width = 176 'B5纸张宽度,单位为毫米
    doc.PageSetting.Height = 250  'B5纸张高度,单位为毫米
ElseIf e.Form.Controls("RadioButton2").Checked = True And e.Form.Controls("ComboBox1").text = e.form.controls("combobox1").items(5) Then
    doc.PageSetting.Width = 420 'A2纸张宽度,单位为毫米
    doc.PageSetting.Height = 594  'A2纸张高度,单位为毫米
ElseIf e.Form.Controls("RadioButton2").Checked = True And e.Form.Controls("ComboBox1").text = e.form.controls("combobox1").items(6) Then
    doc.PageSetting.Width = 105 'A6纸张宽度,单位为毫米
    doc.PageSetting.Height = 148  'A6纸张高度,单位为毫米
ElseIf e.Form.Controls("RadioButton1").Checked = True And e.Form.Controls("TextBox1").text IsNot Nothing And e.Form.Controls("TextBox2").text IsNot Nothing Then
    doc.PageSetting.Width = Val(e.Form.Controls("TextBox2").Value) '自定义纸张宽度,单位为毫米
    doc.PageSetting.Height = Val(e.Form.Controls("TextBox1").Value)  '自定义纸张高度,单位为毫米
Else
    messagebox.show("纸张规格不能为空")
    Return
End If
If e.Form.Controls("ComboBox2").Value Is Nothing Then
    messagebox.show("棋赛名称不能为空")
    Return
End If
Dim c1 As Double = e.Form.Controls("TextBox4").Value
Dim c2 As Double = e.Form.Controls("TextBox5").Value
Dim c3 As Double = Val(doc.PageSetting.Width)
Dim c4 As Double = Val(doc.PageSetting.Height)
Doc.PageSetting.LeftMargin = (c3 - c1*(Math.Floor(c3/c1)))/2 '设置左边距
Doc.PageSetting.RightMargin = (c3 - c1*(Math.Floor(c3/c1)))/2 '设置右边距
Doc.PageSetting.TopMargin = (c4 - c2*(Math.Floor(c4/c2)))/2 '设置上边距
Doc.PageSetting.BottomMargin = (c4 - c2*(Math.Floor(c4/c2)))/2 '设置下边距
For i As Integer = 0 To DataTables("基本信息").SQLCompute("Count(姓名)","[棋赛名称] = '" & e.Form.Controls("ComboBox2").text & "'") - 1
    Dim rt As New prt.RenderTable() '定义一个表格对象
    Dim drs As List(Of DataRow) = DataTables("基本信息").Select("[棋赛名称] = '" & e.Form.Controls("ComboBox2").text & "'")
    If drs IsNot Nothing Then
        rt.Style.GridLines.All = New prt.LineDef '将网格线类型设为默认类型
        rt.Style.GridLines.Horz = new Prt.LineDef(Color.white)
        rt.Style.GridLines.Vert = new Prt.LineDef(Color.white)
        rt.Width = c1 '表格宽度为
        rt.Height = c2
        rt.Style.Spacing.All = 2 '和其他对象之间的间隔为2mm
        rt.SplitVertBehavior = prt.SplitBehaviorEnum.Never '避免垂直换页的时候,表格被分割成两部分.
        rt.Rows.Count = 8 '设置总行数
        rt.Cols.Count = 7 '设置总列数
        rt.Rows(0).Height = 7
        rt.Cols(0).Width = 3
        rt.cells(0,0).SpanCols = 7
        rt.cells(1,1).SpanCols = 5
        rt.Rows(1).Height = 10
        rt.Cells(1,1).Style.FontBold = True
        rt.Cells(1,1).Style.FontName = e.Form.Controls("FontPicker1").Value
        rt.Cells(1,1).Style.FontSize = e.Form.Controls("ComboBox3").Value
        rt.cells(1,1).Text = e.Form.Controls("ComboBox2").text
        rt.cells(1,1).Style.TextAlignHorz = prt.AlignHorzEnum.Center
        rt.cells(1,1).Style.TextAlignVert = prt.AlignHorzEnum.Center
        rt.Cells(2,1).SpanCols = 5
        If drs(i).IsNull("棋赛副名") Then
            rt.Cells(2,1).Text = Nothing
            rt.Rows(2).Height = 0
        Else
            rt.Cells(2,1).Text = drs(i)("棋赛副名")
        End If
        rt.Cells(2,1).Style.FontName = e.Form.Controls("FontPicker2").Value
        rt.Cells(2,1).Style.FontSize = e.Form.Controls("ComboBox4").Value
        rt.Cells(2,1).Style.TextAlignHorz = prt.AlignHorzEnum.Center
        rt.cells(2,1).Style.TextAlignVert = prt.AlignHorzEnum.Center
        rt.Rows(3).Height = 2
        rt.Cols(3).Width = 37
        rt.Rows(4).Height = 30
        rt.Cells(4,3).Text = drs(i)("编号")
        rt.Cells(4,3).Style.FontName = e.Form.Controls("FontPicker3").Value
        rt.Cells(4,3).Style.FontSize = e.Form.Controls("ComboBox5").Value
        rt.Cells(4,3).Style.TextAlignHorz = prt.AlignHorzEnum.Center
        rt.cells(4,3).Style.TextAlignVert = prt.AlignHorzEnum.Center
        rt.Rows(5).Height = 2
        rt.cells(6,2).SpanCols = 3
        rt.Cells(6,2).Text= drs(i)("姓名")
        rt.Cells(6,2).Style.FontName = e.Form.Controls("FontPicker4").Value
        rt.Cells(6,2).Style.FontSize = e.Form.Controls("ComboBox6").Value
        rt.Cells(6,2).Style.TextAlignHorz = prt.AlignHorzEnum.Center
        rt.cells(6,2).Style.TextAlignVert = prt.AlignHorzEnum.Center
        rt.cells(7,0).SpanCols = 7
        rt.Rows(7).Height = 7
        rt.Cols(6).Width = 3
        doc.Body.Children.Add(rt) '将表格对象加入到报表中
    Else
        Return
    End If
Next
Doc.Preview() '预览报表
[此贴子已经被作者于2021/11/7 20:26:51编辑过]

 回到顶部
美女呀,离线,留言给我吧!
采菊东篱下
  38楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:八尾狐 帖子:1881 积分:10368 威望:0 精华:0 注册:2019/4/6 8:45:00
  发帖心情 Post By:2021/11/7 20:05:00 [只看该作者]

现在只剩1、组合框中的字号为中文报错。

 回到顶部
美女呀,离线,留言给我吧!
采菊东篱下
  39楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:八尾狐 帖子:1881 积分:10368 威望:0 精华:0 注册:2019/4/6 8:45:00
  发帖心情 Post By:2021/11/7 20:28:00 [只看该作者]

这段代码没有棋赛副名没问题,有棋赛副名就报错了:
.NET Framework 版本:4.0.30319.18063
Foxtable 版本:2021.11.4.1
错误所在事件:窗口,胸牌排版,Button1,Click
详细错误信息:
Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index

 回到顶部
美女呀,离线,留言给我吧!
采菊东篱下
  40楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:八尾狐 帖子:1881 积分:10368 威望:0 精华:0 注册:2019/4/6 8:45:00
  发帖心情 Post By:2021/11/7 20:49:00 [只看该作者]

 下载信息  [文件大小:   下载次数: ]
图片点击可在新窗口打开查看点击浏览该文件:排版有误.foxdb


 回到顶部
总数 44 上一页 1 2 3 4 5 下一页