From 878b5d2b6a4d807376f3255e52c8ac9ef97d6bc9 Mon Sep 17 00:00:00 2001 From: Sergey Chebotar Date: Tue, 7 Dec 2021 08:27:30 +0300 Subject: [PATCH] Rename export file name field name --- Source/DataExport/DataWriter.cs | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/Source/DataExport/DataWriter.cs b/Source/DataExport/DataWriter.cs index c024a22..7095577 100644 --- a/Source/DataExport/DataWriter.cs +++ b/Source/DataExport/DataWriter.cs @@ -10,12 +10,12 @@ namespace Rehau.Sku.Assist private Application xlApp; private Dictionary SkuAmount { get; set; } private object[,] SelectedCells { get; set; } - private string FileName { get; set; } + private string ExportFileName { get; set; } public DataWriter() { this.xlApp = (Application)ExcelDnaUtil.Application; - this.FileName = AddIn.priceListPath; + this.ExportFileName = AddIn.priceListPath; GetSelectedCells(); } @@ -71,9 +71,24 @@ namespace Rehau.Sku.Assist } } - public void GetPriceListWB() - { - Workbook wb = xlApp.Workbooks.Open(FileName); + public void FillPriceList() + { + Workbook wb = xlApp.Workbooks.Open(ExportFileName); + Worksheet ws = wb.ActiveSheet; + + Range amountCell = ws.Cells.Find("Кол-во"); + + foreach (KeyValuePair kvp in SkuAmount) + { + Range cell = ws.Cells.Find(kvp.Key); + ws.Cells[cell.Row, amountCell.Column].Value = kvp.Value; + } + + //Range filter = ws.Cells[amountCell.Row + 1, amountCell.Column]; + //filter.AutoFilter(1, "<>"); + + wb.Save(); + wb.Close(); } public void Dispose()