-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTestDataValueConverter.cs
More file actions
44 lines (43 loc) · 1.32 KB
/
TestDataValueConverter.cs
File metadata and controls
44 lines (43 loc) · 1.32 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
37
38
39
40
41
42
43
44
using DevExpress.Drawing;
using System;
namespace DataImportExample
{
#region #converter
class TestDataValueConverter : DevExpress.Spreadsheet.IDataValueConverter
{
public bool TryConvert(object value, int columnIndex, out DevExpress.Spreadsheet.CellValue result)
{
switch (value)
{
case string strValue:
try
{
result = DXImage.FromBase64String(strValue);
}
catch
{
int str2int = 0;
if (Int32.TryParse(strValue, out str2int))
{
result = str2int;
}
else
{
result = strValue;
}
}
return true;
case int intValue:
result = intValue;
return true;
case bool boolValue:
result = boolValue;
return true;
default:
result = value == null ? null : value.ToString();
return true;
}
}
}
#endregion #converter
}