Free Support Forum - aspose.com

Cannot update using array variables via Smart Markers in version 4.5.0.0

It appears that version 4.5.0.0 does not allow me to update my spreadsheet using ARRAY variables (with Smart Markers). Below is the exception I got:

Unable to cast object of type 'System.Double[]' to type 'System.Object[]'.

When I switch back to version 4.4.3.1 this problem goes away. I am attaching my template spreadsheet.

If you confirm this is a problem, please make a new release ASAP. My project does not run anymore. Thanks.

I tested with this simple code:

Module Module1
Sub Main()
Dim SP500(5), MSCI(5) As Double
SP500(0) = 0.23
SP500(1) = 0.24
SP500(2) = 0.25
SP500(3) = 0.26
SP500(4) = 0.27
MSCI(0) = 0.28
MSCI(1) = 0.29
MSCI(2) = 0.3
MSCI(3) = 0.31
MSCI(4) = 0.32

Dim designer As Aspose.Cells.WorkbookDesigner = New Aspose.Cells.WorkbookDesigner()

designer.Open("../../Test.xls")
designer.SetDataSource("SP500", SP500)
designer.SetDataSource("MSCI", MSCI)
designer.Process()
designer.Save("../../result.xls")
End Sub
End Module

Hi,

Please declare your array variables as Object type. i.e.,

Dim SP500(5), MSCI(5) As Object... it will work fine.

Thank you.

Yes, declaring it Object type does solve the problem. Thanks very much.