title: How to Auto size Excel ClosedXml cells in c#
body: <p>I am trying to resize cells so that it fits the maximum length of the text using <code>ClosedXMl.Excel</code> but the cell is giving me this error message:</p>
  
  <blockquote>
    <p>Severity  Code    Description Project File    Line    Suppression State
    Error CS0119  'IXLRangeBase.Cells()' is a method, which is not valid in
    the given context</p>
  </blockquote>
  
  <p>C#:</p>
  
  <pre><code>var workbook = new XLWorkbook();     //creates the workbook
  var wsDetailedData = workbook.AddWorksheet("data"); //creates the worksheet with sheetname 'data'
  
  wsDetailedData.Cell(1, 1).InsertTable(dataList); //inserts the data to cell A1 including default column name
  wsDetailedData.Cells.SizeToContent = true;
  workbook.SaveAs(@"C:\data.xlsx"); //saves the workbook
  </code></pre>