File copying work on
This commit is contained in:
parent
64928b2290
commit
910ba4bf6d
@ -2,6 +2,7 @@
|
|||||||
using Microsoft.Office.Interop.Excel;
|
using Microsoft.Office.Interop.Excel;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
|
||||||
namespace Rehau.Sku.Assist
|
namespace Rehau.Sku.Assist
|
||||||
{
|
{
|
||||||
@ -10,12 +11,12 @@ namespace Rehau.Sku.Assist
|
|||||||
private Application xlApp;
|
private Application xlApp;
|
||||||
private Dictionary<string, double> SkuAmount { get; set; }
|
private Dictionary<string, double> SkuAmount { get; set; }
|
||||||
private object[,] SelectedCells { get; set; }
|
private object[,] SelectedCells { get; set; }
|
||||||
private string ExportFileName { get; set; }
|
private string WorkingFileName { get; set; }
|
||||||
|
|
||||||
public DataWriter()
|
public DataWriter()
|
||||||
{
|
{
|
||||||
this.xlApp = (Application)ExcelDnaUtil.Application;
|
this.xlApp = (Application)ExcelDnaUtil.Application;
|
||||||
this.ExportFileName = AddIn.priceListPath;
|
this.WorkingFileName = xlApp.ActiveWorkbook.FullName;
|
||||||
|
|
||||||
GetSelectedCells();
|
GetSelectedCells();
|
||||||
}
|
}
|
||||||
@ -71,25 +72,31 @@ namespace Rehau.Sku.Assist
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void FillPriceList()
|
//public void FillPriceList()
|
||||||
{
|
//{
|
||||||
Workbook wb = xlApp.Workbooks.Open(ExportFileName);
|
// string exportFileName = "rehau-export_" + DateTime.Now + ".xlsm";
|
||||||
Worksheet ws = wb.ActiveSheet;
|
// 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];
|
// Workbook wb = xlApp.Workbooks.Open(PriceListFilePath);
|
||||||
//filter.AutoFilter(1, "<>");
|
// Worksheet ws = wb.ActiveSheet;
|
||||||
|
|
||||||
wb.Save();
|
// Range amountCell = ws.Cells.Find("Кол-во");
|
||||||
wb.Close();
|
|
||||||
}
|
// 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()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
|
@ -37,7 +37,7 @@ namespace Ribbon
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
dw.FillSkuAmountDict();
|
dw.FillSkuAmountDict();
|
||||||
dw.FillPriceList();
|
//dw.FillPriceList();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user