更新时间:2023-01-31 21:54:57
如何在c#中设计html表???
如何在wpf apllication中将sql server表值传递给html格式
how to design html table in c# ???
how to pass sql server table values into html format in wpf apllication
您不需要将数据导出为html格式!
您需要做的就是使用 DataGrid [ ^ ]控件,用于显示表格数据。
有关详细信息,请参阅:
包含行详细信息的DataGrid - 完整的WPF教程 [ ^ ]
WPF DataGrid实际示例 [ ^ ]
WPF Datagrid [ ^ ]
You don't need to export data into html format!
All you need to do is to use DataGrid[^] control, which is used to display tabular data.
For further details, please see:
DataGrid with row details - The complete WPF tutorial[^]
WPF DataGrid Practical Examples[^]
WPF Datagrid[^]
查看以下文章,解释如何使用带代码示例的C#创建动态html表,
CodeChef4U |使用C#创建动态HTML表 [ ^ ]
Check following post that explains how to create dynamic html table using C# with code sample,
CodeChef4U | Creating Dynamic HTML table using C#[^]
string WriteTable(DataTable dt)
{
StringBuilder sb = new StringBuilder();
sb.Append(@"
<table>
<tr>
<th>No</th>
<th>Code</th>
<th>Name</th>
</tr>
");
foreach(DataRow dr in dt.Rows)
{
sb.Append("<tr>");
sb.AppendFormat("<td>{0}</td>", dr["no"]);
sb.AppendFormat("<td>{0}</td>", dr["code"]);
sb.AppendFormat("<td>{0}</td>", dr["name"]);
sb.Append("</tr>");
}
sb.Append("</table>");
return sb.ToString();
}