From 7a36779492ceb1acab7e3edbf94f359104fe0344 Mon Sep 17 00:00:00 2001 From: VinothSF5015 Date: Tue, 12 May 2026 15:33:16 +0530 Subject: [PATCH 1/2] 1005966 - Sample Added --- FAQ/Last Row/Last Row.slnx | 3 ++ FAQ/Last Row/Last Row/Last Row.csproj | 21 +++++++++++++ FAQ/Last Row/Last Row/Output/.gitkeep | 0 FAQ/Last Row/Last Row/Program.cs | 45 +++++++++++++++++++++++++++ 4 files changed, 69 insertions(+) create mode 100644 FAQ/Last Row/Last Row.slnx create mode 100644 FAQ/Last Row/Last Row/Last Row.csproj create mode 100644 FAQ/Last Row/Last Row/Output/.gitkeep create mode 100644 FAQ/Last Row/Last Row/Program.cs diff --git a/FAQ/Last Row/Last Row.slnx b/FAQ/Last Row/Last Row.slnx new file mode 100644 index 00000000..307586d0 --- /dev/null +++ b/FAQ/Last Row/Last Row.slnx @@ -0,0 +1,3 @@ + + + diff --git a/FAQ/Last Row/Last Row/Last Row.csproj b/FAQ/Last Row/Last Row/Last Row.csproj new file mode 100644 index 00000000..3384bc4c --- /dev/null +++ b/FAQ/Last Row/Last Row/Last Row.csproj @@ -0,0 +1,21 @@ + + + + Exe + net8.0 + Last_Row + enable + enable + + + + + + + + + Always + + + + diff --git a/FAQ/Last Row/Last Row/Output/.gitkeep b/FAQ/Last Row/Last Row/Output/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/FAQ/Last Row/Last Row/Program.cs b/FAQ/Last Row/Last Row/Program.cs new file mode 100644 index 00000000..360a8bee --- /dev/null +++ b/FAQ/Last Row/Last Row/Program.cs @@ -0,0 +1,45 @@ +using Syncfusion.XlsIO; +using Syncfusion.XlsIO.Implementation; +using Syncfusion.XlsIO.Implementation.Collections; + +class Program +{ + static void Main(string[] args) + { + // Create an instance of ExcelEngine + using (ExcelEngine excelEngine = new ExcelEngine()) + { + IApplication application = excelEngine.Excel; + IWorkbook workbook = application.Workbooks.Create(1); + + IWorksheet sheet = workbook.Worksheets[0]; + sheet["A1:B10"].Text = "10"; + sheet["C1:C5"].Text = "20"; + + int lastRow = GetLastRow(3, sheet as WorksheetImpl); + Console.WriteLine("Last Row in Column C: " + lastRow); + + workbook.SaveAs(Path.GetFullPath("Output/Output.xlsx")); + } + } + + private static int GetLastRow(int column, WorksheetImpl worksheet) + { + int firstRow = worksheet.UsedRange.Row; + int lastRow = worksheet.UsedRange.LastRow; + for (int iRow = lastRow; iRow >= firstRow; iRow--) + { + RowStorage rowStorage = WorksheetHelper.GetOrCreateRow(worksheet, iRow - 1, false); + if (rowStorage != null) + { + RowStorageEnumerator enumerator = rowStorage.GetEnumerator(worksheet.RecordExtractor) as RowStorageEnumerator; + while (enumerator.MoveNext()) + { + if (enumerator.ColumnIndex + 1 == column) + return iRow; + } + } + } + return -1; + } +} From 10311e032da13434507bf723b9b04e2173e66790 Mon Sep 17 00:00:00 2001 From: VinothSF5015 Date: Tue, 12 May 2026 17:27:58 +0530 Subject: [PATCH 2/2] 1005966 - Modified --- FAQ/Last Row/{ => .NET/Last Row}/Last Row.slnx | 0 FAQ/Last Row/{ => .NET/Last Row}/Last Row/Last Row.csproj | 0 FAQ/Last Row/{ => .NET/Last Row}/Last Row/Output/.gitkeep | 0 FAQ/Last Row/{ => .NET/Last Row}/Last Row/Program.cs | 0 4 files changed, 0 insertions(+), 0 deletions(-) rename FAQ/Last Row/{ => .NET/Last Row}/Last Row.slnx (100%) rename FAQ/Last Row/{ => .NET/Last Row}/Last Row/Last Row.csproj (100%) rename FAQ/Last Row/{ => .NET/Last Row}/Last Row/Output/.gitkeep (100%) rename FAQ/Last Row/{ => .NET/Last Row}/Last Row/Program.cs (100%) diff --git a/FAQ/Last Row/Last Row.slnx b/FAQ/Last Row/.NET/Last Row/Last Row.slnx similarity index 100% rename from FAQ/Last Row/Last Row.slnx rename to FAQ/Last Row/.NET/Last Row/Last Row.slnx diff --git a/FAQ/Last Row/Last Row/Last Row.csproj b/FAQ/Last Row/.NET/Last Row/Last Row/Last Row.csproj similarity index 100% rename from FAQ/Last Row/Last Row/Last Row.csproj rename to FAQ/Last Row/.NET/Last Row/Last Row/Last Row.csproj diff --git a/FAQ/Last Row/Last Row/Output/.gitkeep b/FAQ/Last Row/.NET/Last Row/Last Row/Output/.gitkeep similarity index 100% rename from FAQ/Last Row/Last Row/Output/.gitkeep rename to FAQ/Last Row/.NET/Last Row/Last Row/Output/.gitkeep diff --git a/FAQ/Last Row/Last Row/Program.cs b/FAQ/Last Row/.NET/Last Row/Last Row/Program.cs similarity index 100% rename from FAQ/Last Row/Last Row/Program.cs rename to FAQ/Last Row/.NET/Last Row/Last Row/Program.cs