老师您好,请问日期“2024-01-01”、时间“14:25”、长日期时间“2024-01-01 14:25”,能分别判断吗?
For c As Integer = 0 To dt.Cols.Count - 1
If dt.Cols(c).Visible Then
ls=ls+1
For r As Integer = 0 To dt.Rows.Count - 1
If dt.Cols(c).IsDate Then '如果是数值或日期列
sheet(r + hdr + 2, cnt).value = Format(CDate(dt(r, c)), "yyyy-MM-dd HH:mm")
Else
sheet(r + hdr+2,cnt).value = dt(r,c)
End If
If dt.rows(r)(c)=Nothing Then
sheet(r + hdr+2,cnt).value =""
End If
Sheet(r+hdr+2,cnt).Style = Style
Sheet(r + hdr+2,cnt).Style.WordWrap=True'自动换行
Next
cnt = cnt + 1
End If
Next