aboutsummaryrefslogtreecommitdiff
path: root/src/AddIn/WorksheetExtensions.cs
diff options
context:
space:
mode:
authorSerghei Cebotari <51533848+schebotar@users.noreply.github.com>2022-02-05 13:18:18 +0300
committerGitHub <noreply@github.com>2022-02-05 13:18:18 +0300
commitad7234fda7927c45e5ca457facae71a4b9be6b31 (patch)
treed9fc89b0e02a5fdc92d54674b7b48ad2d10859e4 /src/AddIn/WorksheetExtensions.cs
parent180807d749f4eb3a16c1f136d42b90ea2945008f (diff)
parenteb6a28b955b5b179bd40f21dcf1daa6f9337765f (diff)
Merge pull request #15 from schebotar/dev
Dev
Diffstat (limited to 'src/AddIn/WorksheetExtensions.cs')
-rw-r--r--src/AddIn/WorksheetExtensions.cs32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/AddIn/WorksheetExtensions.cs b/src/AddIn/WorksheetExtensions.cs
new file mode 100644
index 0000000..51ce13a
--- /dev/null
+++ b/src/AddIn/WorksheetExtensions.cs
@@ -0,0 +1,32 @@
+using Microsoft.Office.Interop.Excel;
+using System.Linq;
+
+namespace RehauSku
+{
+ public static class WorksheetExtensions
+ {
+ private static string amountHeader = "Кол-во";
+ private static string skuHeader = "Актуальный материал";
+ private static string groupHeader = "Программа";
+ private static string nameHeader = "Наименование";
+
+ public static bool IsRehauSource(this Worksheet worksheet)
+ {
+ Range amountCell;
+ Range skuCell;
+ Range groupCell;
+ Range nameCell;
+
+ Range[] cells = new[]
+ {
+ amountCell = worksheet.Cells.Find(amountHeader),
+ skuCell = worksheet.Cells.Find(skuHeader),
+ groupCell = worksheet.Cells.Find(groupHeader),
+ nameCell = worksheet.Cells.Find(nameHeader)
+ };
+
+ return cells.All(x => x != null);
+ }
+ }
+}
+