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;
|
2022-01-07 19:04:07 +03:00
|
|
|
|
|
|
|
|
|
namespace RehauSku.PriceListTools
|
|
|
|
|
{
|
2022-01-27 10:22:30 +03:00
|
|
|
|
internal class CombineTool : PriceListTool
|
2022-01-07 19:04:07 +03:00
|
|
|
|
{
|
2022-01-27 17:34:03 +03:00
|
|
|
|
public List<Source> SourceFiles;
|
|
|
|
|
|
|
|
|
|
public void FillTarget()
|
2022-01-07 19:04:07 +03:00
|
|
|
|
{
|
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-07 19:04:07 +03:00
|
|
|
|
{
|
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-28 12:37:02 +03:00
|
|
|
|
Range newColumnHeader = TargetFile.Sheet.Cells[TargetFile.amountCell.Row, TargetFile.amountCell.Column - 1];
|
|
|
|
|
newColumnHeader.Value2 = $"{source.Name}";
|
|
|
|
|
newColumnHeader.WrapText = true;
|
2022-01-27 17:34:03 +03:00
|
|
|
|
|
2022-01-28 15:11:39 +03:00
|
|
|
|
FillColumn(source.PositionAmount, TargetFile.amountCell.Column - 1, TargetFile.amountCell.Column);
|
2022-01-27 20:43:19 +03:00
|
|
|
|
}
|
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();
|
2022-01-07 19:04:07 +03:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|