Dim g As New CrossTableBuilder("每日工时统计", DataTables("研发工时系统"))
g.HGroups.AddDef("研发部门")
g.HGroups.AddDef("研发人员")
g.HGroups.AddDef("研发项目")
g.VGroups.AddDef("研发日期", "{0}月")
g.VGroups.AddDef("研发日期", DateGroupEnum.Day, "{0}日")
g.Totals.AddDef("研发工时_本日工时", "研发工时_本日工时")
g.HorizontalTotal = True
g.VerticalTotal = True
g.Decimals = 0
g.Subtotal = True
g.Build()
MainTable = Tables("每日工时统计")
老师您好,上面的代码,如何同时在日期列显示是星期几?谢谢!
……
g.Build()
for each dc as datacol in dataTables("每日工时统计").datacolsif dc.caption like "*日" then
dim ss() as string = dc.caption.split("月")
dim d as date = new date(date.today.year,cint(ss(0)),cint(ss(1).trim("日")))
dc.Caption = dc.Caption & "-" & Format(d, "dddd")
end if
next
dataTables("每日工时统计").BuildHeader()
.NET Framework 版本:4.0.30319.42000
Foxtable 版本:2022.8.18.1
详细错误信息:
从字符串“_1”到类型“Integer”的转换无效。
输入字符串的格式不正确。
老师好,调试的时候提示上面错误。
For Each dc As DataCol In DataTables("每日工时统计").datacols
If dc.caption Like "*日" Then
MessageBox.Show(1)
Dim ss() As String = dc.caption.split("月")
MessageBox.Show(2)
Dim d As Date = New Date(Date.today.year, CInt(ss(0)), CInt(ss(1).trim("日")))
MessageBox.Show(3)
dc.Caption = dc.Caption & "-" & Format(d, "dddd")
MessageBox.Show(4)
End If
Next
DataTables("每日工时统计").BuildHeader()
MessageBox.Show(5)
老师好,测试只能弹出数字 1 和 2
MessageBox.Show(1)改为MessageBox.Show(dc.caption),看出错时候 的标题名是什么
Dim ss() As String = dc.caption.split("_")
MessageBox.Show(2)
Dim d As Date = New Date(Date.today.year, CInt(ss(0).trim("月")), CInt(ss(1).trim("日")))
dc.Caption = dc.Caption & "-" & Format(d, "dddd")
MessageBox.Show(dc.Caption)