'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
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