Here's my code so far (VB):
Dim wb As New ClosedXML.Excel.XLWorkbook()
wb.Worksheets.Add(dTable, "export")
wb.SaveAs(location)
How can I remove just styling of the alternate rows (defaults to light blue)
Here's my code so far (VB):
Dim wb As New ClosedXML.Excel.XLWorkbook()
wb.Worksheets.Add(dTable, "export")
wb.SaveAs(location)
How can I remove just styling of the alternate rows (defaults to light blue)
Assuming you want to skip the header row, something like this should work before the save.
For i As Integer = 2 To wb.Worksheets.Worksheet("export").Rows.Count
wb.Worksheets.Worksheet("export").Row(i).Style.Fill.SetBackgroundColor(XLColor.White)
Next
While the answer from @JimHewitt is correct, it is a brute force way and looping over all rows, which is waste of time for a large table. The more elegant way is to remove the Theme
dim ws As ClosedXML.Excel.IXLWorksheet = wb.Worksheets.Add(dTable, "export")
ws.Tables.FirstOrDefault().Theme = New ClosedXML.Excel.XLTableTheme("None")
See Project Documentation for all other available Themes https://github.com/ClosedXML/ClosedXML/blob/78150efbbd4a36d65e95ef3c793f12feb12c1a9c/ClosedXML/Excel/Tables/XLTableTheme.cs