我正在尝试使用
ClosedXML.Excel
调整单元格大小以适应文本的最大长度,但该单元格给出了以下错误信息:
C#:Severity Code Description Project File Line Suppression State Error CS0119 'IXLRangeBase.Cells()' is a method, which is not valid in the given context
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