-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathTestDataValueConverter.cs
36 lines (33 loc) · 1.09 KB
/
TestDataValueConverter.cs
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
using DevExpress.Drawing;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace DataImportExample
{
#region #converter
class TestDataValueConverter : DevExpress.Spreadsheet.IDataValueConverter
{
private bool IDataValueConverter_TryConvert(object value, int index, ref CellValue result) {
if (value is string) {
string strValue = value as string;
try
{
result = DXImage.FromBase64String(strValue);
}
catch
{
int str2int = 0;
if (Int32.TryParse(strValue, ref str2int))
result = str2int;
else
result = strValue;
}
return true;
}
result = DevExpress.Spreadsheet.CellValue.TryCreateFromObject(value);
return true;
}
}
#endregion #converter
}