35 lines
1000 B
C#
35 lines
1000 B
C#
#if !NET472
|
|
using System.Runtime.Versioning;
|
|
using RhSolutions.Tools;
|
|
#endif
|
|
|
|
using System.Text.RegularExpressions;
|
|
|
|
namespace RhSolutions.Services;
|
|
|
|
#if !NET472
|
|
[SupportedOSPlatform("windows")]
|
|
#endif
|
|
public class NewPriceWriter : ExcelWriterBase, IWriter, IDisposable
|
|
{
|
|
public NewPriceWriter(Application application, IAddInConfiguration configuration)
|
|
{
|
|
_application = application;
|
|
_resultBar = new();
|
|
_headers = configuration.GetPriceListHeaders();
|
|
_worksheet = OpenNewPrice(configuration.GetPriceListPath());
|
|
}
|
|
|
|
private Worksheet OpenNewPrice(string pricelistPath)
|
|
{
|
|
if (_application.Workbooks
|
|
.Cast<Workbook>()
|
|
.FirstOrDefault(w => w.FullName == pricelistPath) != null)
|
|
{
|
|
throw new ArgumentException("Шаблонный файл редактируется в другом месте");
|
|
}
|
|
|
|
return _application.Workbooks.Open(pricelistPath, null, true).ActiveSheet;
|
|
}
|
|
}
|