Write Collection Direct 0 -63 1.25 7f99ecc6-c8d5-4f76-980e-945380988e38 Writes the given collection into the specified sheet. -195 -105 180 90 7f99ecc6-c8d5-4f76-980e-945380988e38 45 -135 60 30 94411eff-31dc-41ad-8569-444908993fb5 7f99ecc6-c8d5-4f76-980e-945380988e38 45 60 60 30 7f99ecc6-c8d5-4f76-980e-945380988e38 -255 -30 120 30 number 7f99ecc6-c8d5-4f76-980e-945380988e38 -255 60 120 30 text 7f99ecc6-c8d5-4f76-980e-945380988e38 -255 15 120 30 text 7f99ecc6-c8d5-4f76-980e-945380988e38 -135 60 120 30 flag 7f99ecc6-c8d5-4f76-980e-945380988e38 45 -75 120 30 d36b4ab6-34b1-4eb5-9d3a-dffc1c294215 733c2840-8162-465a-a8f2-7d023087c369 7f99ecc6-c8d5-4f76-980e-945380988e38 45 -15 120 30 d06de8c0-76d8-4e01-ae58-aea82f0e598c dtRowCount Then blRowCount = dtRowCount - blStart Else blRowCount = rowlimit End If Dim objXlData(blRowCount, dtColCount) As Object For iRow As Integer = blStart To blStart + blRowCount - 1 For iCol As Integer = 0 To dtColCount - 1 If IsDBNull(Collection.Rows(iRow).Item(iCol)) Then objXlData(iRow-blStart, iCol) = "" Elseif TypeOf Collection.Rows(iRow).Item(iCol) is String then If Left(Collection.Rows(iRow).Item(iCol),1) = "=" then objXlData(iRow-blStart, iCol) = "'" & Collection.Rows(iRow).Item(iCol) Else objXlData(iRow-blStart, iCol) = Collection.Rows(iRow).Item(iCol) End if Elseif TypeOf Collection.Rows(iRow).Item(iCol) is DataTable then Dim sw as StringWriter = new StringWriter() Collection.Rows(iRow).Item(iCol).WriteXml(sw) objXlData(iRow-blStart, iCol) = sw.ToString() Else objXlData(iRow-blStart, iCol) = Collection.Rows(iRow).Item(iCol) End If Next Next xlWorkSheet.Range(cellref).Offset(OffsetRow+blStart,0).Resize(blRowCount, dtColCount).Value = objXlData 'below SetProperty does the same as above, but uses system Culture, which is inconsistent. I intentionally dont want to do that. 'SetProperty(xlWorkSheet.Range(cellref).Offset(OffsetRow+blStart,0).Resize(blRowCount, dtColCount), "Value", objXlData) objXlData = Nothing GC.Collect() Next xlWorkSheet=Nothing Collection = Nothing System.Runtime.GCSettings.LargeObjectHeapCompactionMode = System.Runtime.GCLargeObjectHeapCompactionMode.CompactOnce GC.Collect() ]]> 7f99ecc6-c8d5-4f76-980e-945380988e38 -135 -30 120 30 text A1 7f99ecc6-c8d5-4f76-980e-945380988e38 -135 15 120 30 number 5000