From dc1e8616a6ebeb89cbe76dccc5a771481cefb8af Mon Sep 17 00:00:00 2001 From: Serghei Cebotari Date: Mon, 27 May 2024 23:39:43 +0300 Subject: [PATCH] Fix merged column ordering --- RhSolutions.AddIn/Services/ExcelReader.cs | 6 +++--- RhSolutions.AddIn/Services/GuessReader.cs | 4 ++-- RhSolutions.AddIn/Services/IReader.cs | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/RhSolutions.AddIn/Services/ExcelReader.cs b/RhSolutions.AddIn/Services/ExcelReader.cs index 74048c9..6c334b9 100644 --- a/RhSolutions.AddIn/Services/ExcelReader.cs +++ b/RhSolutions.AddIn/Services/ExcelReader.cs @@ -79,7 +79,7 @@ public class ExcelReader : IReader, IDisposable return readResult; } - public List<(string, Dictionary)> + public IEnumerable<(string, Dictionary)> ReadProducts(IEnumerable worksheets) { List<(string, Dictionary)> result = new(); @@ -151,10 +151,10 @@ public class ExcelReader : IReader, IDisposable result.Add((wbName, readResult)); } - return result; + return result.OrderBy(x => x.Item1); } - public List<(string, Dictionary)> ReadProducts(string[] files) + public IEnumerable<(string, Dictionary)> ReadProducts(string[] files) { HashSet openedFiles = RhSolutionsAddIn.Excel.Workbooks .Cast() diff --git a/RhSolutions.AddIn/Services/GuessReader.cs b/RhSolutions.AddIn/Services/GuessReader.cs index 86e7d27..d61217d 100644 --- a/RhSolutions.AddIn/Services/GuessReader.cs +++ b/RhSolutions.AddIn/Services/GuessReader.cs @@ -192,7 +192,7 @@ public class GuessReader : IReader return result; } - public List<(string, Dictionary)> ReadProducts(IEnumerable worksheets) + public IEnumerable<(string, Dictionary)> ReadProducts(IEnumerable worksheets) { List<(string, Dictionary)> result = new(); foreach (Worksheet worksheet in worksheets) @@ -206,7 +206,7 @@ public class GuessReader : IReader return result; } - public List<(string, Dictionary)> ReadProducts(string[] files) + public IEnumerable<(string, Dictionary)> ReadProducts(string[] files) { _progressBar = new("Открываю исходные файлы...", files.Length); List worksheets = new(); diff --git a/RhSolutions.AddIn/Services/IReader.cs b/RhSolutions.AddIn/Services/IReader.cs index a2474cc..1ec1a0e 100644 --- a/RhSolutions.AddIn/Services/IReader.cs +++ b/RhSolutions.AddIn/Services/IReader.cs @@ -3,7 +3,7 @@ public interface IReader : IDisposable { public Dictionary ReadProducts(Range range); - public List<(string, Dictionary)> ReadProducts(IEnumerable worksheets); - public List<(string, Dictionary)> ReadProducts(string[] files); + public IEnumerable<(string, Dictionary)> ReadProducts(IEnumerable worksheets); + public IEnumerable<(string, Dictionary)> ReadProducts(string[] files); new void Dispose(); }