diff --git a/FAQ/First used cell in used range/.NET/FirstUsedCellInUsedRange/FirstUsedCellInUsedRange.slnx b/FAQ/First used cell in used range/.NET/FirstUsedCellInUsedRange/FirstUsedCellInUsedRange.slnx new file mode 100644 index 00000000..3e98a114 --- /dev/null +++ b/FAQ/First used cell in used range/.NET/FirstUsedCellInUsedRange/FirstUsedCellInUsedRange.slnx @@ -0,0 +1,3 @@ + + + diff --git a/FAQ/First used cell in used range/.NET/FirstUsedCellInUsedRange/FirstUsedCellInUsedRange/Data/Input.xlsx b/FAQ/First used cell in used range/.NET/FirstUsedCellInUsedRange/FirstUsedCellInUsedRange/Data/Input.xlsx new file mode 100644 index 00000000..c1277106 Binary files /dev/null and b/FAQ/First used cell in used range/.NET/FirstUsedCellInUsedRange/FirstUsedCellInUsedRange/Data/Input.xlsx differ diff --git a/FAQ/First used cell in used range/.NET/FirstUsedCellInUsedRange/FirstUsedCellInUsedRange/FirstUsedCellInUsedRange.csproj b/FAQ/First used cell in used range/.NET/FirstUsedCellInUsedRange/FirstUsedCellInUsedRange/FirstUsedCellInUsedRange.csproj new file mode 100644 index 00000000..39a86120 --- /dev/null +++ b/FAQ/First used cell in used range/.NET/FirstUsedCellInUsedRange/FirstUsedCellInUsedRange/FirstUsedCellInUsedRange.csproj @@ -0,0 +1,23 @@ + + + + Exe + net10.0 + enable + enable + + + + + + + + + Always + + + Always + + + + diff --git a/FAQ/First used cell in used range/.NET/FirstUsedCellInUsedRange/FirstUsedCellInUsedRange/Output/.gitkeep b/FAQ/First used cell in used range/.NET/FirstUsedCellInUsedRange/FirstUsedCellInUsedRange/Output/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/FAQ/First used cell in used range/.NET/FirstUsedCellInUsedRange/FirstUsedCellInUsedRange/Program.cs b/FAQ/First used cell in used range/.NET/FirstUsedCellInUsedRange/FirstUsedCellInUsedRange/Program.cs new file mode 100644 index 00000000..8ed10623 --- /dev/null +++ b/FAQ/First used cell in used range/.NET/FirstUsedCellInUsedRange/FirstUsedCellInUsedRange/Program.cs @@ -0,0 +1,33 @@ +using Syncfusion.XlsIO; + +namespace FirstUsedCellInUsedRange +{ + class Program + { + public 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/Input.xlsx")); + IWorksheet worksheet = workbook.Worksheets[0]; + + //Get the used range of the worksheet + IRange usedRange = worksheet.UsedRange; + + //Get the first cell from the used range + IRange firstCell = worksheet.Range[usedRange.Row, usedRange.Column]; + + //Get the address of the first cell + string firstCellAddress = firstCell.AddressLocal; + + //Display the address of the first cell + Console.WriteLine("The address of the first used cell in used range is: " + firstCellAddress); + + //Saving the workbook + workbook.SaveAs(Path.GetFullPath(@"Output/Output.xlsx")); + } + } + } +} \ No newline at end of file