1

I am working with closedXML in C#. I'm importing an Excel. It is importing correct data but auto-format rows and headers every time. I need to compare data of Excel file in C# with a standard template. Due to formatting, it doesn't match. Can somebody help me to remove theme/ autoformat from Excel in C#?

DataTable dt = _excecuteProcedure.ToDataTable(filteredAmenities);
using(XLWorkbook wb = new XLWorkbook())
{
    var ws = wb.Worksheets.Add(dt);
    ws.Tables.FirstOrDefault().ShowAutoFilter = false;
    ws.Name = "Sheet1";
    using(MemoryStream stream = new MemoryStream())
        {
             wb.SaveAs(stream);
             return File(stream.ToArray(), "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "Template.xlsx");

        }
}

0 Answers0