I would suggest using spreadsheetlight available from NuGet and DocumentFormat.OpenXml. Both are free libraries.
Why?
Because these libraries don't use Excel automation but OpenXML for Excel which is many times faster than Excel automation.
Simple export
Imports SpreadsheetLight
Public Class ExcelOperations
Public Sub SimpleExportRaw(pFileName As String, pSheetName As String, pDataTable As DataTable, pColumnHeaders As Boolean)
Using doc As New SLDocument()
doc.SelectWorksheet(pSheetName)
doc.ImportDataTable(1, SLConvert.ToColumnIndex("A"), pDataTable, pColumnHeaders)
doc.SaveAs(pFileName)
End Using
End Sub
End Class
Some helpers
After creating and instance of SLDocument you can (where doc is a SLDocument)
- AutoFit columns e.g. doc.AutoFitColumn("A")
- Create and apply styles via doc.CreateStyle which in turn allows you to do things like text alignment, bold, italics etc.