简体   繁体   中英

Adding data to the last row not empty of excel sheet c#

Im trying to add data to the last row, and I googled and came up with code below but it does not work for me what is it that I'm doing wrong?

XLWorkbook wb = new XLWorkbook();
var ws = wb.Worksheets.Add(config.ReportName);
MapFilters(ws, excelReportSource.Filters);
ws.Cell(3, 1).InsertTable(dataTable);
long fullrow = ws.Rows().Count();
long lastRow = ws.Cells[fullrow, 1].get_End(ClosedXML.Excel.XlDirection.xlUp).Row;

The last row in my code I get syntax error on ws.Cells[fullrow, 1] , am I missing a namespace?

ws.Cells[fullrow, 1] is the syntax for the EPPlus library, not ClosedXML. You're obviously mixing code meant for different libraries.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM