Is it possible to create an excel file from a list of objects in c#?
Documentation only shows how to create it from a DataTable
//Create a workbook
Workbook workbook = new Workbook();
//Create an empty worksheet
workbook.CreateEmptySheets(1);
//Get the first worksheet
Worksheet sheet = workbook.Worksheets[0];
//Create an ArrayList object
ArrayList list = new ArrayList();
//Add strings in list
list.Add("Spire.Doc for .NET");
list.Add("Spire.XLS for .NET");
list.Add("Spire.PDF for .NET");
list.Add("Spire.Presentation for .NET");
//Insert array list in worksheet
sheet.InsertArrayList(list, 1, 1, true);
//Save the Excel file
string result = "ImportDataFromArrayList_out.xlsx";
workbook.SaveToFile(result, ExcelVersion.Version2013);
var list = new List<MySheet> { new MySheet { Value1 = 1, Value2 = 2, Value3 = 3 } };