非自然月考勤表,想生成多层表头,想要的样式:
此主题相关图片如下:2.png

sqltable类型表 ,生成代码
Dim y As WinForm.ComboBox = e.Form.Controls("CBYear") ‘选择的年
Dim m As WinForm.ComboBox = e.Form.Controls("CBMonth") ’选择的月
Dim tb As String="考勤管理_Table1"
If y.Value <> "" AndAlso m.Value <> "" Then
Dim ye As Integer=iif(m.Value -1 = 0,y.Value-1,y.Value)
Dim mt As Integer=iif(m.Value -1 = 0,12,m.Value -1)
Dim ts As Integer= Date.DaysInMonth(ye,mt) ’获取上个月的最多天数
'MessageBox.Show(ts)
Select Case ts ‘移除多余列
Case 30
Tables(tb).Cols.Remove("三十一")
Case 29
Tables(tb).Cols.Remove("三十一","三十")
Case 28
Tables(tb).Cols.Remove("三十一","三十","二十九")
End Select
With DataTables(tb) ’更改列标题
For i As Integer = 1 To Tables(tb).Cols.Count - 3
If CInt(Tables(tb).Cols(i).Caption) > 25
' Output.Show(Tables("订单").Cols(i).Caption)
.DataCols(i).Caption = mt & "月_" & Tables(tb).Cols(i).Caption
Else
.DataCols(i).Caption = mt+1 & "月_" & Tables(tb).Cols(i).Caption
End If
Next
.MultiRowHeader = True
.BuildHeader()
End With
End If
结果没有达到效果:

此主题相关图片如下:1.jpg

[此贴子已经被作者于2022/4/27 14:52:59编辑过]