I have repro'd a minimal, reproducible example. The "Book1.xlsx" is a blank, brand new excel document. When I run this code, the file "Book2.xlsx" pops up in my folder. When I go to open "Book2.xlsx", I get an excel error. The file cannot be recovered "because it is corrupt."

static void Main(string[] args)
{
    SLDocument sl = new SLDocument("Book1.xlsx");
    sl.SelectWorksheet("Sheet1");
    sl.SetCellValue("A1", "Be content in all circumstances");
    sl.SaveAs("Book2.xlsx");
}

I am running Excel 2016 and .NETFramework v4.8

I have tried many things, such as changing the DocumentFormat.OpenXML to version 2.5.

0

There are 0 best solutions below