-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMyColumnDetector.vb
More file actions
36 lines (31 loc) · 1.29 KB
/
MyColumnDetector.vb
File metadata and controls
36 lines (31 loc) · 1.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
Imports DevExpress.Spreadsheet
Namespace SpreadsheetDocumentServerAsDataSourceExample
#Region "#MyColumnDetector"
Friend Class MyColumnDetector
Implements IDataSourceColumnTypeDetector
Public Function GetColumnName(ByVal index As Integer, ByVal offset As Integer, ByVal range As CellRange) As String Implements IDataSourceColumnTypeDetector.GetColumnName
Return range(-1, offset).DisplayText
End Function
Public Function GetColumnType(ByVal index As Integer, ByVal offset As Integer, ByVal range As CellRange) As Type Implements IDataSourceColumnTypeDetector.GetColumnType
Dim defaultType As Type = GetType(String)
If offset = 13 Then
Return GetType(DevExpress.Drawing.DXImage)
End If
Dim value As CellValue = range(0, offset).Value
If value.IsText Then
Return GetType(String)
End If
If value.IsBoolean Then
Return GetType(Boolean)
End If
If value.IsDateTime Then
Return GetType(Date)
End If
If value.IsNumeric Then
Return GetType(Double)
End If
Return defaultType
End Function
End Class
#End Region
End Namespace