Spire.XLS is a professional Excel API that enables developers to create, manage, manipulate, convert and print Excel worksheets. Get free and professional technical support for Spire.XLS for .NET, Java, Android, C++, Python.

Sun Dec 18, 2016 11:23 am

Hello:

I have the following list
Dim mListaOrder As New List(Of Order)()
The definition of the function is:
Public Function InsertArray(Of T)(objects() As T, firstRow As Integer, firstColumn As Integer, isVertical As Boolean) As Integer

I have the following code
sheet.InsertArray(Of Order)(mListaOrder, 2, 1, True)

The error that gives me is:
A value of type System.Collection.Generic.List (Order) can not be converted to -1 dimensional array of Order

Greetings from Bilbao
Carlos

aricarlos
 
Posts: 2
Joined: Mon Dec 05, 2016 9:47 am

Mon Dec 19, 2016 6:17 am

Dear Carlos,

Sorry for late reply as weekend and thanks for your inquiry.
Kindly note that the List( Order in your code ) is not array, and it cannot be converted to array directly, please make sure they are same type when you use the custom function InsertArray.

Sincerely,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Wed Dec 21, 2016 7:13 am

Dear Carlos,

How is the issue now ?
Could you please give us some feedback at your convenience ?

Thanks,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Fri Dec 23, 2016 10:39 am

Hello:
Since you can not use list (Of T), you convert these to datatable
Greetings from Bilbao
Carlos

aricarlos
 
Posts: 2
Joined: Mon Dec 05, 2016 9:47 am

Mon Dec 26, 2016 6:03 am

Dear Carlos,

Sorry for late reply as weekend.
Why you get the error is because the list cannot be converted to array directly, you can use ToArray method, like this.
worksheet.InsertArray(Of T)(mListaOrder.ToArray, 2, 1, True)
And there is a tutorial for your kind reference.
If there is still issue, please provide us more information and the entire code you were using.

Sincerely,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Return to Spire.XLS