Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.
Aspose.Cells also supports anonymous types or custom objects in smart markers. In the example below, the Product class needs to be defined before use.
string FilePath = @"..\..\..\Sample Files\";
string FileName = FilePath + "Using Custom Objects.xlsx";
// Instantiate the WorkbookDesigner object.
WorkbookDesigner report = new WorkbookDesigner();
// Get the first worksheet (default sheet) in the workbook.
Aspose.Cells.Worksheet w = report.Workbook.Worksheets[0];
// Input some markers to the cells.
w.Cells["A1"].PutValue("Test");
w.Cells["A2"].PutValue("&=MyProduct.Name");
w.Cells["B2"].PutValue("&=MyProduct.Age");
// Instantiate the list collection based on the custom class.
IList<MyProduct> list = new List<MyProduct>();
// Provide values for the markers using the custom class object.
list.Add(new MyProduct("Simon", 30));
list.Add(new MyProduct("Johnson", 33));
// Set the data source.
report.SetDataSource("MyProduct", list);
// Process the markers.
report.Process(false);
// Save the Excel file.
report.Workbook.Save(FileName);
Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.