// Spludlow Software // Copyright © Samuel P. Ludlow 2020 All Rights Reserved // Distributed under the terms of the GNU General Public License version 3 // Distributed WITHOUT ANY WARRANTY; without implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE // https://www.spludlow.co.uk/LICENCE.TXT // The Spludlow logo is a registered trademark of Samuel P. Ludlow and may not be used without permission // v1.14 using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Data; namespace Spludlow { public class HTML { public static string MakeTable(string textTable) { return MakeTable(textTable, false); } public static string MakeTable(string textTable, bool removeEmptyEntries) { DataTable table = Spludlow.Data.TextTable.ReadText(textTable, removeEmptyEntries); return MakeTable(table); } public static string MakeTable(DataTable table) { return MakeTable(table, null); } public static string MakeTable(DataTable table, string tableStyle) { StringBuilder html = new StringBuilder(); html.Append(""); html.Append(""); foreach (DataColumn column in table.Columns) { html.Append(""); html.Append(column.ColumnName); html.Append(""); } html.AppendLine(""); foreach (DataRow row in table.Rows) { html.Append(""); foreach (DataColumn column in table.Columns) { html.Append(""); if (row.IsNull(column) == false) html.Append(Convert.ToString(row[column])); html.Append(""); } html.AppendLine(""); } html.AppendLine(""); return html.ToString(); } } }