From ce5597d042062c820288c63b4e571ee77ac23ab0 Mon Sep 17 00:00:00 2001 From: Sergey Chebotar Date: Wed, 22 Dec 2021 17:07:37 +0300 Subject: RegistryUtil and some fixes --- Source/DataExport/Exporter.cs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'Source/DataExport') diff --git a/Source/DataExport/Exporter.cs b/Source/DataExport/Exporter.cs index 483dd0e..95b3186 100644 --- a/Source/DataExport/Exporter.cs +++ b/Source/DataExport/Exporter.cs @@ -34,7 +34,7 @@ namespace RehauSku.DataExport SelectedCells.GetLength(1) == 2; } - public void FillSkuAmountDict() + private void FillSkuAmountDict() { SkuAmount = new Dictionary(); int rowsCount = SelectedCells.GetLength(0); @@ -73,20 +73,22 @@ namespace RehauSku.DataExport } } - public void FillPriceList() + public void FillNewPriceList() { + FillSkuAmountDict(); string exportFile = _GetExportFullPath(); File.Copy(RegistryUtil.PriceListPath, exportFile, true); Workbook wb = xlApp.Workbooks.Open(exportFile); Worksheet ws = wb.ActiveSheet; - Range amountCell = ws.Cells.Find("Кол-во"); + int amountColumn = ws.Cells.Find("Кол-во").Column; + int skuColumn = ws.Cells.Find("Актуальный материал").Column; foreach (KeyValuePair kvp in SkuAmount) { - Range cell = ws.Cells.Find(kvp.Key); - ws.Cells[cell.Row, amountCell.Column].Value = kvp.Value; + Range cell = ws.Columns[skuColumn].Find(kvp.Key); + ws.Cells[cell.Row, amountColumn].Value = kvp.Value; } ws.Cells.AutoFilter(7, "<>"); -- cgit v1.2.3