-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathTestDataValueConverter.vb
37 lines (32 loc) · 1.17 KB
/
TestDataValueConverter.vb
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
37
Imports DevExpress.Drawing
Imports DevExpress.Spreadsheet
Imports System
Imports System.Collections.Generic
Imports System.Linq
Imports System.Runtime.InteropServices
Imports System.Text
Namespace DataImportExample
#Region "#converter"
Friend Class TestDataValueConverter
Implements IDataValueConverter
Private Function IDataValueConverter_TryConvert(value As Object, index As Integer, ByRef result As CellValue) As Boolean Implements IDataValueConverter.TryConvert
If TypeOf value Is String Then
Dim strValue As String = TryCast(value, String)
Try
result = DXImage.FromBase64String(strValue)
Catch
Dim str2int As Integer = 0
If Int32.TryParse(strValue, str2int) Then
result = str2int
Else
result = strValue
End If
End Try
Return True
End If
result = DevExpress.Spreadsheet.CellValue.TryCreateFromObject(value)
Return True
End Function
End Class
#End Region ' #converter
End Namespace