ecco il codice:
codice:
Public Shared Function WriteSystemArray(ByVal wsIndex As Integer, ByVal rowIndex As Long, ByVal colIndex As Long, ByVal value As System.Array) As Integer
For x As Integer = value.GetLowerBound(0) To value.GetUpperBound(0)
For y As Integer = value.GetLowerBound(1) To value.GetUpperBound(1)
If ColonnaVuota(value, y) = False Then
DirectCast(_ws(wsIndex).Cells(rowIndex + x, colIndex + y), Excel.Range).Value = value(x, y)
End If
Next y
Next x
Return 0
End Function
Public Shared Function ColonnaVuota(ByVal matrix As System.Array, ByVal ColNum As Integer) As Boolean
Dim contaVuoti As Integer = 0
Dim contaTutti As Integer = 0
For x As Integer = matrix.GetLowerBound(0) To matrix.GetUpperBound(0)
If Trim(matrix(x, ColNum)) = "" Then
contaVuoti += 1
End If
contaTutti += 1
Next
If contaTutti = contaVuoti Then
Return True
Else
Return False
End If
End Function
_ws è il worksheet.