diff --git a/FAQ/FormulaError Value/.NET/FormulaError Value/FormulaError Value.slnx b/FAQ/FormulaError Value/.NET/FormulaError Value/FormulaError Value.slnx new file mode 100644 index 00000000..ddae22f0 --- /dev/null +++ b/FAQ/FormulaError Value/.NET/FormulaError Value/FormulaError Value.slnx @@ -0,0 +1,3 @@ + + + diff --git a/FAQ/FormulaError Value/.NET/FormulaError Value/FormulaError Value/Data/InputTemplate.xlsx b/FAQ/FormulaError Value/.NET/FormulaError Value/FormulaError Value/Data/InputTemplate.xlsx new file mode 100644 index 00000000..d644aed6 Binary files /dev/null and b/FAQ/FormulaError Value/.NET/FormulaError Value/FormulaError Value/Data/InputTemplate.xlsx differ diff --git a/FAQ/FormulaError Value/.NET/FormulaError Value/FormulaError Value/FormulaError Value.csproj b/FAQ/FormulaError Value/.NET/FormulaError Value/FormulaError Value/FormulaError Value.csproj new file mode 100644 index 00000000..410b207b --- /dev/null +++ b/FAQ/FormulaError Value/.NET/FormulaError Value/FormulaError Value/FormulaError Value.csproj @@ -0,0 +1,24 @@ + + + + Exe + net8.0 + FormulaError_Value + enable + enable + + + + + + + + + Always + + + Always + + + + diff --git a/FAQ/FormulaError Value/.NET/FormulaError Value/FormulaError Value/Output/.gitkeep b/FAQ/FormulaError Value/.NET/FormulaError Value/FormulaError Value/Output/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/FAQ/FormulaError Value/.NET/FormulaError Value/FormulaError Value/Program.cs b/FAQ/FormulaError Value/.NET/FormulaError Value/FormulaError Value/Program.cs new file mode 100644 index 00000000..ad809c4d --- /dev/null +++ b/FAQ/FormulaError Value/.NET/FormulaError Value/FormulaError Value/Program.cs @@ -0,0 +1,34 @@ +using Syncfusion.XlsIO; + +class Program +{ + static void Main(string[] args) + { + using (ExcelEngine excelEngine = new ExcelEngine()) + { + IApplication application = excelEngine.Excel; + application.DefaultVersion = ExcelVersion.Xlsx; + IWorkbook workbook = application.Workbooks.Open(Path.GetFullPath(@"Data/InputTemplate.xlsx")); + IWorksheet worksheet = workbook.Worksheets[0]; + + IRange usedRange = worksheet.UsedRange; + int firstrow = usedRange.Row; + int lastrow = usedRange.LastRow; + int firstcol = usedRange.Column; + int lastcol = usedRange.LastColumn; + + for (int row = firstrow; row <= lastrow; row++) + { + for (int col = firstcol; col <= lastcol; col++) + { + if (worksheet[row, col] != null && worksheet[row, col].HasFormulaErrorValue) + { + Console.WriteLine($"Formula error value: {worksheet[row, col].FormulaErrorValue} in Address: {worksheet[row, col].AddressLocal}"); + } + } + } + + workbook.SaveAs(Path.GetFullPath(@"Output/Output.xlsx")); + } + } +} \ No newline at end of file