aboutsummaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
authorSergey Chebotar <s.chebotar@gmail.com>2021-12-08 09:45:03 +0300
committerSergey Chebotar <s.chebotar@gmail.com>2021-12-08 09:45:03 +0300
commit910ba4bf6ddf8415bf3a8db78d4c85e4ccd45bd6 (patch)
treebbd9aa53f299eed983f63f2a79324ff24bee5063 /Source
parent64928b2290e931cdceb0cc7f832159fb38b1209a (diff)
File copying work on
Diffstat (limited to 'Source')
-rw-r--r--Source/DataExport/DataWriter.cs41
-rw-r--r--Source/DataExport/RibbonController.cs2
2 files changed, 25 insertions, 18 deletions
diff --git a/Source/DataExport/DataWriter.cs b/Source/DataExport/DataWriter.cs
index 7095577..30a3e83 100644
--- a/Source/DataExport/DataWriter.cs
+++ b/Source/DataExport/DataWriter.cs
@@ -2,6 +2,7 @@
using Microsoft.Office.Interop.Excel;
using System;
using System.Collections.Generic;
+using System.IO;
namespace Rehau.Sku.Assist
{
@@ -10,12 +11,12 @@ namespace Rehau.Sku.Assist
private Application xlApp;
private Dictionary<string, double> SkuAmount { get; set; }
private object[,] SelectedCells { get; set; }
- private string ExportFileName { get; set; }
+ private string WorkingFileName { get; set; }
public DataWriter()
{
this.xlApp = (Application)ExcelDnaUtil.Application;
- this.ExportFileName = AddIn.priceListPath;
+ this.WorkingFileName = xlApp.ActiveWorkbook.FullName;
GetSelectedCells();
}
@@ -71,25 +72,31 @@ namespace Rehau.Sku.Assist
}
}
- public void FillPriceList()
- {
- Workbook wb = xlApp.Workbooks.Open(ExportFileName);
- Worksheet ws = wb.ActiveSheet;
+ //public void FillPriceList()
+ //{
+ // string exportFileName = "rehau-export_" + DateTime.Now + ".xlsm";
+ // string workingDir = xlApp.ActiveWorkbook.Path;
- Range amountCell = ws.Cells.Find("Кол-во");
+ // //File.Copy(Path.GetFullPath(PriceListFilePath), Path.Combine(WorkingFileName, exportFileName + ".xlsm"));
- foreach (KeyValuePair<string,double> 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, "<>");
+ // Workbook wb = xlApp.Workbooks.Open(PriceListFilePath);
+ // Worksheet ws = wb.ActiveSheet;
- wb.Save();
- wb.Close();
- }
+ // Range amountCell = ws.Cells.Find("Кол-во");
+
+ // foreach (KeyValuePair<string, double> kvp in SkuAmount)
+ // {
+ // Range cell = ws.Cells.Find(kvp.Key);
+ // ws.Cells[cell.Row, amountCell.Column].Value = kvp.Value;
+ // }
+
+ // //Range filter = ws.Range["H16:H4058"];
+ // ws.Cells.AutoFilter(7, "<>");
+
+ // //wb.Save();
+ // //wb.Close();
+ //}
public void Dispose()
{
diff --git a/Source/DataExport/RibbonController.cs b/Source/DataExport/RibbonController.cs
index 3ae9099..5c4045a 100644
--- a/Source/DataExport/RibbonController.cs
+++ b/Source/DataExport/RibbonController.cs
@@ -37,7 +37,7 @@ namespace Ribbon
else
{
dw.FillSkuAmountDict();
- dw.FillPriceList();
+ //dw.FillPriceList();
}
}
}