2023-04-06 08:29:39 +03:00
|
|
|
|
using RhSolutions.AddIn;
|
|
|
|
|
#if !NET472
|
|
|
|
|
using System.Runtime.Versioning;
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
namespace RhSolutions.Tools;
|
|
|
|
|
|
|
|
|
|
#if !NET472
|
|
|
|
|
[SupportedOSPlatform("windows")]
|
|
|
|
|
#endif
|
2023-04-14 08:08:46 +03:00
|
|
|
|
internal class ConvertTool : Tool
|
2023-04-06 08:29:39 +03:00
|
|
|
|
{
|
2023-04-17 08:49:26 +03:00
|
|
|
|
public ConvertTool(IServiceProvider provider) : base(provider)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2023-04-06 08:29:39 +03:00
|
|
|
|
public override void Execute()
|
|
|
|
|
{
|
|
|
|
|
Application app = RhSolutionsAddIn.Excel.Application;
|
|
|
|
|
Worksheet worksheet = app.ActiveWorkbook.ActiveSheet;
|
2023-05-22 07:39:48 +03:00
|
|
|
|
_reader = _readerFactory.GetReader("Excel");
|
2023-06-20 07:25:44 +03:00
|
|
|
|
_writer = _writerFactory.GetWriter("NewPrice");
|
2023-05-23 07:33:40 +03:00
|
|
|
|
var products = _reader.ReadProducts(new[] { worksheet });
|
2023-04-06 08:29:39 +03:00
|
|
|
|
_writer.WriteProducts(products);
|
|
|
|
|
}
|
|
|
|
|
}
|