Add convert Tool

This commit is contained in:
Sergey Chebotar 2022-01-28 09:08:35 +03:00
parent 71fcd9ee86
commit 722de64dad
2 changed files with 32 additions and 1 deletions

View File

@ -6,6 +6,27 @@ using System.Linq;
namespace RehauSku.PriceListTools namespace RehauSku.PriceListTools
{ {
internal class ConvertTool : PriceListTool
{
private Source Current;
public void GetCurrent()
{
Current = new Source(ExcelApp.ActiveWorkbook);
}
public void FillTarget()
{
ExcelApp.ScreenUpdating = false;
FillColumn(Current.SkuAmount, TargetFile.amountCell.Column);
FilterByAmount();
ExcelApp.ScreenUpdating = true;
Forms.Dialog.SaveWorkbookAs();
}
}
internal abstract class PriceListTool internal abstract class PriceListTool
{ {
protected private Application ExcelApp = (Application)ExcelDnaUtil.Application; protected private Application ExcelApp = (Application)ExcelDnaUtil.Application;

View File

@ -20,13 +20,14 @@ namespace RehauSku.Ribbon
<tab id='rau' label='REHAU'> <tab id='rau' label='REHAU'>
<group id='priceList' label='Прайс-лист'> <group id='priceList' label='Прайс-лист'>
<button id='exportToPrice' label='Экспорт в новый файл' size='normal' imageMso='PivotExportToExcel' onAction='OnExportPressed'/> <button id='exportToPrice' label='Экспорт в новый файл' size='normal' imageMso='PivotExportToExcel' onAction='OnExportPressed'/>
<button id='convertPrice' label='Обновить прайс-лист' size='normal' imageMso='FileUpdate' onAction='OnConvertPressed'/>
<menu id='conjoinMenu' label='Объединить' imageMso='Copy'> <menu id='conjoinMenu' label='Объединить' imageMso='Copy'>
<button id='mergeFiles' label='Сложить' onAction='OnMergePressed'/> <button id='mergeFiles' label='Сложить' onAction='OnMergePressed'/>
<button id='combineFiles' label='По колонкам' onAction='OnCombinePressed'/> <button id='combineFiles' label='По колонкам' onAction='OnCombinePressed'/>
</menu> </menu>
</group> </group>
<group id='rausettings' label='Настройки'> <group id='rausettings' label='Настройки'>
<button id='setPriceList' label='Файл прайс-листа' size='large' imageMso='CurrentViewSettings' onAction='OnSetPricePressed'/> <button id='setPriceList' label='Указать путь к шаблону' size='large' imageMso='CurrentViewSettings' onAction='OnSetPricePressed'/>
</group> </group>
</tab> </tab>
</tabs> </tabs>
@ -80,6 +81,15 @@ namespace RehauSku.Ribbon
} }
} }
public void OnConvertPressed(IRibbonControl control)
{
ConvertTool convertTool = new ConvertTool();
convertTool.GetCurrent();
convertTool.OpenNewPrice();
convertTool.FillTarget();
}
public void OnSetPricePressed(IRibbonControl control) public void OnSetPricePressed(IRibbonControl control)
{ {
string path = Dialog.GetFilePath(); string path = Dialog.GetFilePath();