We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Exporting anonymous collection to sheet


Presently I use Aspose Cells to generate some Excel based reports via email. I looked at smart tags and they weren’t suitable, as I generate various results with LINQ queries and the columns vary each time.

I use the following method:

// Place data and format header.
sheet.Cells.ImportDataTable(inputData, true, dataStartRow - 1, dataStartCol, inputData.Rows.Count,
inputData.Columns.Count, false, “dd/mm/yyyy”);

However, this requires a DataTable object - and particularly for large datasets, converting to a datatable can take many minutes. Is there a method where I can use an anonymous collection without needing to make a DataTable first?



Well, I think you may try to use anonymous types and custom objects in Smart Markers feature provided by Aspose.Cells, see the document for your reference:
(Note: please see the description text and example under sub-heading: “Using Anonymous Types or Custom Objects” in the document)

Moreover, Aspose.Cells does support to import custom objects directly via its Data importing options, see the document/ article for your reference:

Thank you.

Thanks, I’ll check these out.