How to ignore the green error marker in worksheets?
3 Nov 20252 minutes to read
When there exists data that are of different formats, the error marker appears in cells. In XlsIO You can ignore this by using IgnoreErrorOptions property. The following code snippet illustrate this.
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx", ExcelOpenType.Automatic);
IWorksheet worksheet = workbook.Worksheets[0];
//Ignore Error Options
worksheet.Range["B3"].IgnoreErrorOptions = ExcelIgnoreError.All;
workbook.SaveAs("IgnoreGreenError.xlsx");
workbook.Close();
excelEngine.Dispose();
}using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx", ExcelOpenType.Automatic);
IWorksheet worksheet = workbook.Worksheets[0];
//Ignore Error Options
worksheet.Range["B3"].IgnoreErrorOptions = ExcelIgnoreError.All;
workbook.SaveAs("IgnoreGreenError.xlsx");
}Using excelEngine As ExcelEngine = New ExcelEngine()
Dim application As IApplication = excelEngine.Excel
application.DefaultVersion = ExcelVersion.Excel2013
Dim workbook As IWorkbook = application.Workbooks.Open("Sample.xlsx", ExcelOpenType.Automatic)
Dim worksheet As IWorksheet = workbook.Worksheets(0)
'Ignore Error Options
worksheet.Range("B3").IgnoreErrorOptions = ExcelIgnoreError.All
workbook.SaveAs("IgnoreGreenError.xlsx")
End Using