From e3888653aa9320249bf631fe1fb2c12514dbf535 Mon Sep 17 00:00:00 2001 From: Waheed Ahmad Date: Tue, 18 Jun 2024 03:55:07 +0500 Subject: [PATCH] fixed an issue with get cels content process --- src/WinUI.TableView/TableView.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/WinUI.TableView/TableView.cs b/src/WinUI.TableView/TableView.cs index 3367274..4a34a92 100644 --- a/src/WinUI.TableView/TableView.cs +++ b/src/WinUI.TableView/TableView.cs @@ -262,6 +262,7 @@ public string GetSelectedContent(bool includeHeaders, char separator = '\t') slots = SelectedRanges.SelectMany(x => Enumerable.Range(x.FirstIndex, (int)x.Length)) .SelectMany(r => Enumerable.Range(0, Columns.VisibleColumns.Count) .Select(c => new TableViewCellSlot(r, c))) + .Concat(SelectedCells) .OrderBy(x => x.Row) .ThenByDescending(x => x.Column); } @@ -278,7 +279,6 @@ public string GetAllContent(bool includeHeaders, char separator = '\t') var slots = Enumerable.Range(0, Items.Count) .SelectMany(r => Enumerable.Range(0, Columns.VisibleColumns.Count) .Select(c => new TableViewCellSlot(r, c))) - .Concat(SelectedCells) .OrderBy(x => x.Row) .ThenByDescending(x => x.Column); @@ -287,6 +287,11 @@ public string GetAllContent(bool includeHeaders, char separator = '\t') private string GetCellsContent(IEnumerable slots, bool includeHeaders, char separator) { + if (!slots.Any()) + { + return string.Empty; + } + var minRow = slots.Select(x => x.Row).Min(); var maxRow = slots.Select(x => x.Row).Max(); var minColumn = slots.Select(x => x.Column).Min();