目前可以有办法检测处于编辑状态 但没有接口能取消这个状态
public static void VerifyExcelIsNotInCellEditMode()
{
if (Globals.ThisWorkbook.Application.Interactive)
{
try
{
//Will throw an error if user is editing cell
Globals.ThisWorkbook.Application.Interactive = false;
Globals.ThisWorkbook.Application.Interactive = true;
}
catch
{
throw new Exception("Excel is in Edit Mode.");
}
}
}