'Declaration
Public Class UserObjectImportOptions Inherits ImportOptions
'Usage
Dim instance As UserObjectImportOptions
public class UserObjectImportOptions : ImportOptions
'Declaration
Public Class UserObjectImportOptions Inherits ImportOptions
'Usage
Dim instance As UserObjectImportOptions
public class UserObjectImportOptions : ImportOptions
var workbook = Workbook.Create("test.xlsx" ); var worksheet = workbook.Worksheets[ 0 ]; // Define a list of user objects, the import options (vertical by default, specify PropertyNames and show propertyNames) and call the ImportData function. var userObjectData = new List<Player>() { new Player() { Name = "Tom Sawyer", Team = Team.Miami_Ducks, Number = 9 }, new Player() { Name = "Mike Smith", Team = Team.Chicago_Hornets, Number = 18 }, new Player() { Name = "Kelly Tomson", Team = Team.LosAngelese_Raiders, Number = 33 }, new Player() { Name = "John Graham", Team = Team.NewYork_Bucs, Number = 7 }, }; var userObjectImportOptions = new UserObjectImportOptions() { DestinationTopLeftAddress = "H5", PropertyNames = new string[] { "Name", "Team" }, IsPropertyNamesShown = true }; worksheet.ImportData( userObjectData, userObjectImportOptions ); workbook.Save(); private class Player { public string Name { get; set; } public int Number { get; set; } public Team Team { get; set; } }
System.Object
Xceed.Workbooks.NET.ImportOptions
Xceed.Workbooks.NET.UserObjectImportOptions
Name | Description | |
---|---|---|
![]() | UserObjectImportOptions Constructor |
Name | Description | |
---|---|---|
![]() | DestinationColumnId | Gets or sets the Id of the Column in which the first data item will be imported. (Inherited from Xceed.Workbooks.NET.ImportOptions) |
![]() | DestinationRowId | Gets or sets the Id of the Row in which the first data item will be imported. (Inherited from Xceed.Workbooks.NET.ImportOptions) |
![]() | DestinationTopLeftAddress | Gets or sets the address of the Cell in which the first data item will be imported. (Inherited from Xceed.Workbooks.NET.ImportOptions) |
![]() | IsLinearDataVertical | Gets or sets if the imported linear data (like a List<string>, Array<int>, MyProduct[], ...) will be displayed vertically in the Worksheet. (Inherited from Xceed.Workbooks.NET.ImportOptions) |
![]() | IsPropertyNamesShown | Gets or sets if the user object’s PropertyNames will be shown or not. The default value is false. |
![]() | PropertyNames | Gets or sets the user object’s PropertyNames, which will be displayed in the Worksheet after importing the data. When set to null, which is the default value, all the PropertyNames are displayed. |
Target Platforms: Windows 11, Windows 10, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2