46 lines
1.1 KiB
C#
46 lines
1.1 KiB
C#
#if !NET472
|
|
using System.Runtime.Versioning;
|
|
#endif
|
|
|
|
namespace RhSolutions.Services;
|
|
|
|
#if !NET472
|
|
[SupportedOSPlatform("windows")]
|
|
#endif
|
|
public static class WorksheetExtensions
|
|
{
|
|
public static bool IsRehauSource(this Worksheet worksheet)
|
|
{
|
|
Range amountCell;
|
|
Range skuCell;
|
|
Range programLineCell;
|
|
Range nameCell;
|
|
|
|
var pricelistParameters = RhSolutionsAddIn.Configuration.GetPriceListHeaders();
|
|
|
|
Range[] cells = new[]
|
|
{
|
|
amountCell = worksheet.Cells.Find(pricelistParameters["Amount"]),
|
|
skuCell = worksheet.Cells.Find(pricelistParameters["Sku"]),
|
|
programLineCell = worksheet.Cells.Find(pricelistParameters["ProductLine"]),
|
|
nameCell = worksheet.Cells.Find(pricelistParameters["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;
|
|
}
|
|
}
|
|
}
|
|
|