From f59f0228f6b34194f1e6fc410b99f83064354cc3 Mon Sep 17 00:00:00 2001 From: David Sheiles Date: Mon, 21 Jan 2019 12:52:01 +1100 Subject: [PATCH 1/2] Add Header row to export file Used the UIOMaticField Name attribute to write out the header. --- .../Controllers/ExportController.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/UIOMaticAddons.Export/Controllers/ExportController.cs b/src/UIOMaticAddons.Export/Controllers/ExportController.cs index b6025af..769dc19 100644 --- a/src/UIOMaticAddons.Export/Controllers/ExportController.cs +++ b/src/UIOMaticAddons.Export/Controllers/ExportController.cs @@ -33,7 +33,13 @@ public object GetExport(string typeAlias) //csv.WriteRecords(data); - + //Write Header Row + UIOMaticTypeInfo typeInfo = os.GetTypeInfo(UIOMatic.Helper.GetUIOMaticTypeByAlias(typeAlias), true); + foreach (var item in typeInfo.EditableProperties) + { + csv.WriteField(item.Name); + } + csv.NextRecord(); foreach (var item in data) @@ -66,4 +72,4 @@ public object GetExport(string typeAlias) return new { data = "../App_Plugins/UIOMaticAddons/Exports/" + guid.ToString() + ".csv" }; } } -} \ No newline at end of file +} From 6204e04f09d3605b8802ec6f9d93af9a836364ed Mon Sep 17 00:00:00 2001 From: David Sheiles Date: Mon, 21 Jan 2019 12:59:15 +1100 Subject: [PATCH 2/2] Whoops forgot to reference UIOMatic.Models --- src/UIOMaticAddons.Export/Controllers/ExportController.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/UIOMaticAddons.Export/Controllers/ExportController.cs b/src/UIOMaticAddons.Export/Controllers/ExportController.cs index 769dc19..279e32e 100644 --- a/src/UIOMaticAddons.Export/Controllers/ExportController.cs +++ b/src/UIOMaticAddons.Export/Controllers/ExportController.cs @@ -7,6 +7,7 @@ using Umbraco.Core.IO; using Umbraco.Web.Editors; using System.Text; +using UIOMatic.Models; namespace UIOMaticAddons.Export.Controllers {