RhSolutions-AddIn/RhSolutions.AddIn/Models/WorksheetExtensions.cs
2023-03-28 10:36:36 +03:00

37 lines
858 B
C#

namespace RhSolutions.Services;
public static class WorksheetExtensions
{
public static bool IsRehauSource(this Worksheet worksheet)
{
Range amountCell;
Range skuCell;
Range groupCell;
Range nameCell;
Range[] cells = new[]
{
amountCell = worksheet.Cells.Find(PriceListHeaders.Amount),
skuCell = worksheet.Cells.Find(PriceListHeaders.Sku),
groupCell = worksheet.Cells.Find(PriceListHeaders.Group),
nameCell = worksheet.Cells.Find(PriceListHeaders.Name)
};
return cells.All(x => x != null);
}
public static void AddValue(this Range range, double value)
{
if (range.Value2 == null)
{
range.Value2 = value;
}
else
{
range.Value2 += value;
}
}
}