RhSolutions-AddIn/src/PriceListTools/CombineTool.cs

34 lines
1.0 KiB
C#
Raw Normal View History

2022-01-09 10:37:25 +03:00
using Microsoft.Office.Interop.Excel;
2022-01-27 17:34:03 +03:00
using System.Collections.Generic;
using System.Linq;
namespace RehauSku.PriceListTools
{
2022-01-27 10:22:30 +03:00
internal class CombineTool : PriceListTool
{
2022-01-27 17:34:03 +03:00
public List<Source> SourceFiles;
public void FillTarget()
{
2022-01-27 17:34:03 +03:00
ExcelApp.ScreenUpdating = false;
2022-01-27 20:43:19 +03:00
foreach (Source source in SourceFiles)
{
2022-01-27 17:34:03 +03:00
TargetFile.Sheet.Columns[TargetFile.amountCell.Column]
2022-01-26 17:41:46 +03:00
.EntireColumn
.Insert(XlInsertShiftDirection.xlShiftToRight, XlInsertFormatOrigin.xlFormatFromRightOrBelow);
2022-01-09 10:37:25 +03:00
2022-01-27 17:34:03 +03:00
TargetFile.Sheet.Cells[TargetFile.amountCell.Row, TargetFile.amountCell.Column - 1].Value2 = $"{source.Name}";
2022-01-27 20:43:19 +03:00
FillColumn(source.SkuAmount, TargetFile.amountCell.Column - 1);
FillColumn(source.SkuAmount, TargetFile.amountCell.Column);
}
2022-01-09 10:37:25 +03:00
2022-01-27 20:43:19 +03:00
FilterByAmount();
ExcelApp.ScreenUpdating = true;
2022-01-09 10:37:25 +03:00
2022-01-27 20:43:19 +03:00
Forms.Dialog.SaveWorkbookAs();
}
}
}