Hi,
Can someone help me with this. I would like to import a arraylist of multiple object to an excell sheet. How can i do this?
Can you also directly import a datagrid into an excell sheet?
Tim
Hi Tim,
Thanks for your suggestion. I will add a method to import an arraylist. Now you can use ArrayList.CopyTo method to copy data in the arraylist to an Array.
About the datagrid import issue, I will investigate it and add it if possible.
@TimTec,
Aspose.Excel is discontinued and is replaced with a new advanced product Aspose.Cells which provides rich features along with importing data in a variety of ways. Following is an example which demonstrates importing data from array list.
// Instantiating a Workbook object
Workbook workbook = new Workbook();
// Obtaining the reference of the worksheet
Worksheet worksheet = workbook.Worksheets[0];
// Instantiating an ArrayList object
ArrayList list = new ArrayList();
// Add few names to the list as string values
list.Add("laurence chen");
list.Add("roman korchagin");
list.Add("kyle huang");
list.Add("tommy wang");
// Importing the contents of ArrayList to 1st row and first column vertically
worksheet.Cells.ImportArrayList(list, 0, 0, true);
// Saving the Excel file
workbook.Save(dataDir + "DataImport.out.xls");
Following document link provides more details about importing data into worksheet:
Import Data into worksheet
Here you may find the latest version of this product for a free trial:
Aspose.Cells for .NET (Latest Version)
A ready to run solution for testing the product features can be downloaded here.