This project has moved and is read-only. For the latest updates, please go here.

How to remove table theme?

May 4, 2012 at 1:15 AM

I'm still learning the basics, and I love how simple everything is...except I cannot figure out how to remove the default styling.

I'm creating my worksheet out of a DataTable, which works great.


var wb = new XLWorkbook();
var ws = wb.Worksheets.Add(dt);

Unfortunately, I need to remove all the borders and header styling, and nothing I try works. The only progress I have made is these two lines to remove the filtering and the row stripes:

ws.Tables.First().ShowAutoFilter = false;
ws.Tables.First().ShowRowStripes = false;

There is no default/blank theme, and I cannot set this to null:

ws.Tables.First().Theme = XLTableTheme.???
What can else I do?



May 4, 2012 at 4:27 AM

I have absolutely no idea. How would you do it in Excel?

May 5, 2012 at 9:47 AM

There is a CLEAR Menu within the TableStyles Combobox.

Select a table, Go to TableTools Design Ribbon, Table Styles, Clear.

May 9, 2012 at 7:25 PM

Thanks, I see what you mean. I ended up copying the data manually from the DataTable to the Cells, which was pretty painless and doesn't add any formatting that comes with using Tables in excel.

May 9, 2012 at 7:34 PM

I misunderstood. I thought you wanted to keep the table (a range with special properties) but without any formatting.

What you want seems to be to convert the table to a range. To do this just delete the table definition: worksheet.Tables.Remove(index/name)

Mar 3, 2013 at 6:19 PM
I have been trying to remove the default table theme and set it to a blank theme
has any one figured this out yet.

Thanks any help will be appreciated
Sep 9, 2014 at 7:47 PM
theme property must be set as:
ws.Tables.First().Theme = ClosedXML.Excel.XLTableTheme.None;

So, your code must look like this:
ws.Tables.First().ShowAutoFilter = false;
ws.Tables.First().ShowRowStripes = false;
ws.Tables.First().Theme = ClosedXML.Excel.XLTableTheme.None;