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

Free Support Forum - aspose.com

Using ImportCustomObjects on an object containing a nested object

I have an array of objects, and am trying to populate a worksheet using ImportCustomObjects. Each object contains a nested object with its own properties. How can I reference the properties in the nested objects? I have tried variations on dot and # notation, with no success.

myWorksheet.Cells.ImportCustomObjects(items, new string[] { "FriendlyName", "Address", 
"TestData.TestedDate", "TestData.ResultString", "TestData.Message" },
                true, 0, 0, items.Count, true, "MM/dd/yyyy HH:mm:ss", false);

    public class MyNestedClass
    {
        public string ResultString{ get; set; }
        public string Message{ get; set; }
        public DateTime TestedDate { get; set; }

    }
    public class MyClass
    {
        public string FriendlyName { get; set; }
        public string Address { get; set; }
        public string Field3 { get; set; }
        public string Field4 { get; set; }
        public MyNestedClass TestData { get; set; }
    }

@sumta

Thanks for using Aspose APIs.

Please spare us some time, we will look into your issue and update you asap.

@sumta,

Thanks for using Aspose APIs.

We have tested your code and concluded that nested objects are not supported by ImportCustomObjects() method. So, we logged a New Feature request in our database to support them in future releases if possible.

This issue has been logged as

  • CELLSNET-45535 - Support Nested Objects inside the ImportCustomObjects() method

However, one level nested objects are supported by Smart Markers. Please see this screenshot

For sample code and help, please see this article and its section

Thanks for your response. I will look into Smart Markers.

@sumta

Thanks for considering Aspose APIs.

We are afraid, we will not support the feature logged earlier as CELLSNET-45535, please use Smart Markers instead as discussed above for your needs.