diff --git a/DocxTemplater/DynamicTable.cs b/DocxTemplater/DynamicTable.cs index 02d92d0..0e3456a 100644 --- a/DocxTemplater/DynamicTable.cs +++ b/DocxTemplater/DynamicTable.cs @@ -5,13 +5,15 @@ namespace DocxTemplater { public class DynamicTable : IDynamicTable { + private readonly IEqualityComparer m_headerComparer; private readonly List> m_rows; - public IEnumerable Headers => m_rows.SelectMany(x => x.Keys).Distinct().ToList(); + public IEnumerable Headers => m_rows.SelectMany(x => x.Keys).Distinct(m_headerComparer).ToList(); public IEnumerable> Rows => m_rows.Select(x => x.Values.ToList()).ToList(); - public DynamicTable() + public DynamicTable(IEqualityComparer headerComparer = null) { + m_headerComparer = headerComparer ?? EqualityComparer.Default; m_rows = new List>(); }