static void Main(string[] args)
{
using (XLWorkbook workBook = new XLWorkbook("C:\\report.xlsx"))
{
IXLWorksheet xl = workBook.Worksheet(1);
xl.CopyTo(workBook, "Abc");
IXLWorksheet w = workBook.Worksheet("Abc");
IXLCell lastCell = w.Table("DayPart").LastCell();
IXLCell firstCell = w.Table("DayPart").FirstCell();
w.Tables.Remove("DayPart");
w.Range(firstCell, lastCell).CreateTable("DayPart");
w.Save();
}
}
System.ArgumentOutOfRangeException HResult=0x80131502 Message=Specified argument was out of the range of valid values. Parameter name: id Source=DocumentFormat.OpenXml StackTrace: at DocumentFormat.OpenXml.Packaging.OpenXmlPartContainer.GetPartById(String id) at ClosedXML.Excel.XLWorkbook.GenerateTables(XLWorksheet worksheet, WorksheetPart worksheetPart, SaveContext context, XLWSContentManager cm) at ClosedXML.Excel.XLWorkbook.GenerateWorksheetPartContent(WorksheetPart worksheetPart, XLWorksheet xlWorksheet, Boolean evaluateFormulae, SaveContext context) at ClosedXML.Excel.XLWorkbook.CreateParts(SpreadsheetDocument document, SaveOptions options) at ClosedXML.Excel.XLWorkbook.CreatePackage(String filePath, SpreadsheetDocumentType spreadsheetDocumentType, SaveOptions options) at ClosedXML.Excel.XLWorkbook.Save(SaveOptions options) at ClosedXML.Excel.XLWorkbook.Save(Boolean validate, Boolean evaluateFormulae) at ClosedXML.Excel.XLWorkbook.Save()
Just deleting a table from copied worksheet using ClosedXML giving above error. Please provide a relevant solution. I am using the latest version 0.93.1.1 of the ClosedXML.