RhSolutions-AddIn/RhSolutions.AddIn/Tools/ConvertTool.cs
2023-05-23 07:33:40 +03:00

26 lines
664 B
C#

using RhSolutions.AddIn;
#if !NET472
using System.Runtime.Versioning;
#endif
namespace RhSolutions.Tools;
#if !NET472
[SupportedOSPlatform("windows")]
#endif
internal class ConvertTool : Tool
{
public ConvertTool(IServiceProvider provider) : base(provider)
{
}
public override void Execute()
{
Application app = RhSolutionsAddIn.Excel.Application;
Worksheet worksheet = app.ActiveWorkbook.ActiveSheet;
_reader = _readerFactory.GetReader("Excel");
_writer = _writerFactory.GetWriter("Excel");
var products = _reader.ReadProducts(new[] { worksheet });
_writer.WriteProducts(products);
}
}