【发布时间】:2018-11-13 17:48:42
【问题描述】:
我使用了此链接中发布的解决方案 Fast Export of Large Datatable to Excel Spreadsheet in VB.Net
并且工作得很好,但是当我的代码导出超过 15513 行时,代码失败并且仅在列上显示“#N/A”。如下图所示
Error on export a big number of lines 查看使用的代码:
'numero de linhas
Dim Nbligne As Long = dt.Rows.Count
'Grava o cabeçalho das colunas e os dados
For Each dc In dt.Columns
colIndex = colIndex + 1
'Cabeçalhos
oWsh.Cells(1, colIndex) = dc.ColumnName
oWsh.Cells(2, colIndex).Resize(Nbligne, ).Value = oXls.Application.transpose(dt.Rows.OfType(Of DataRow)().[Select](Function(k) CObj(k(dc.ColumnName))).ToArray())
Next
PS:此代码继续在当前应用程序中运行,因为仅在少数情况下我有超过 15000 条记录,但我需要一个明确的解决方案来解决这个问题。 ;-)
有人可以帮我吗?
【问题讨论】:
标签: excel vb.net export-to-excel