Skip to main content
Row

DataSourceImportOptions Class

Allows you to specify data source fields to import.

Namespace: DevExpress.Spreadsheet

Assembly: DevExpress.Spreadsheet.v24.2.Core.dll

NuGet Package: DevExpress.Spreadsheet.Core

Declaration

public class DataSourceImportOptions :
    DataImportOptions

Remarks

When calling the WorksheetExtensions.Import method, create the DataSourceImportOptions instance and use the DataSourceImportOptions.PropertyNames property to specify field names which should be imported form the data source.

Example

View Example

List<TestObject> list = new List<TestObject>();
list.Add(new TestObject(1, "1", true));
list.Add(new TestObject(2, "2", false));
worksheet.Import(list, 0, 0, new DataSourceImportOptions() { PropertyNames = new string[] { "BoolValue", "IntValue" } });
class TestObject
{
    public TestObject(int intValue, string value, bool boolValue)
    {
        this.intValue = intValue;
        this.Value = value;
        this.BoolValue = boolValue;

    }
    public int intValue;
    private int privateValue { get { return 123; } }
    public int IntValue { get { return intValue + privateValue - 123; } }
    public string Value { get; set; }
    public bool BoolValue { get; set; }
    public int this[int index] { get { return index; } }
}

Inheritance

Object
DataImportOptions
DataSourceImportOptions
See Also