diff options
author | Sergey Chebotar <s.chebotar@gmail.com> | 2023-06-20 09:51:25 +0300 |
---|---|---|
committer | Sergey Chebotar <s.chebotar@gmail.com> | 2023-06-20 09:51:25 +0300 |
commit | 8c134644ba3d75421152ec98c61f3a88e49b3705 (patch) | |
tree | 6d3a813b16c372461caa8404d400cae486dec5a0 | |
parent | f570dd9a2dbc51b07d18e68698c972345d8dc457 (diff) |
Fix filling filtered table
-rw-r--r-- | RhSolutions.AddIn/Services/ExcelWriterBase.cs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/RhSolutions.AddIn/Services/ExcelWriterBase.cs b/RhSolutions.AddIn/Services/ExcelWriterBase.cs index 3376563..2a98b21 100644 --- a/RhSolutions.AddIn/Services/ExcelWriterBase.cs +++ b/RhSolutions.AddIn/Services/ExcelWriterBase.cs @@ -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) { |