Fix filling filtered table

This commit is contained in:
Sergey Chebotar 2023-06-20 09:51:25 +03:00
parent f570dd9a2d
commit 8c134644ba

View File

@ -38,6 +38,8 @@ namespace RhSolutions.Services
$"Целевой файл {_application.ActiveWorkbook.Name} не является прайс-листом.");
}
ShowFilteredData();
_amountCell = _worksheet.Cells.Find(_headers["Amount"]);
_skuCell = _worksheet.Cells.Find(_headers["Sku"]);
_programLineCell = _worksheet.Cells.Find(_headers["ProductLine"]);
@ -187,12 +189,24 @@ namespace RhSolutions.Services
private void FilterByAmount()
{
if (_worksheet.AutoFilterMode)
{
AutoFilter filter = _worksheet.AutoFilter;
int startColumn = filter.Range.Column;
filter.Range.AutoFilter(_amountCell.Column - startColumn + 1, "<>0", XlAutoFilterOperator.xlAnd, "<>");
_worksheet.Range["A1"].Activate();
}
}
private void ShowFilteredData()
{
if (_worksheet.AutoFilterMode)
{
AutoFilter filter = _worksheet.AutoFilter;
filter.ShowAllData();
}
}
private int? GetPositionRow(Range range, ProductSku sku, string productLine, bool justArticle = false)
{