Skip to content
This repository has been archived by the owner on Sep 4, 2023. It is now read-only.

Commit

Permalink
Made changes to support new export architecture
Browse files Browse the repository at this point in the history
  • Loading branch information
NealGeilen committed Jun 4, 2022
1 parent 38bba90 commit 0d40855
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
using Epsilon.Abstractions.Export;
using Epsilon.Canvas.Abstractions.Data;
using ExcelLibrary.SpreadSheet;
using Microsoft.Extensions.Options;

namespace Epsilon.Export;
namespace Epsilon.Export.Exporters;

public class ExcelCanvasModuleFileExporter : ICanvasModuleFileExporter
public class ExcelModuleExporter : ICanvasModuleExporter
{
public bool CanExport(string format) => format.ToLower() == "xls";
private readonly ExportOptions _options;

public ExcelModuleExporter(IOptions<ExportOptions> options)
{
_options = options.Value;
}

public IEnumerable<string> Formats { get; } = new[] { "xls" };

public List<Outcome> GetAllOutcomesTypes(Module module)
{
Expand Down Expand Up @@ -39,7 +47,7 @@ public int GetOutcomeRow(List<Outcome> outcomes, Outcome outcome)
return 0;
}

public void Export(IEnumerable<Module> modules, string path)
public void Export(IEnumerable<Module> modules, string format)
{
Workbook workbook = new Workbook();

Expand Down Expand Up @@ -83,6 +91,6 @@ public void Export(IEnumerable<Module> modules, string path)

}
}
workbook.Save(path + ".xls");
workbook.Save($"{_options.FormattedOutputName}.{format}");
}
}
1 change: 1 addition & 0 deletions Epsilon/Extensions/CoreServiceCollectionExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ private static IServiceCollection AddExport(this IServiceCollection services, IC

services.AddScoped<ICanvasModuleExporter, ConsoleModuleExporter>();
services.AddScoped<ICanvasModuleExporter, CsvModuleExporter>();
services.AddScoped<ICanvasModuleExporter, ExcelModuleExporter>();

services.AddScoped<IModuleExporterCollection, ModuleExporterCollection>();

Expand Down

0 comments on commit 0d40855

Please sign in to comment.