20210520
This commit is contained in:
@@ -914,6 +914,10 @@ namespace FineUIPro.Web
|
||||
{
|
||||
html = (row.FindControl("lblSpecialEquipmentId") as AspNet.Label).Text;
|
||||
}
|
||||
if (column.ColumnID == "CheckManNames")
|
||||
{
|
||||
html = (row.FindControl("lbCheckManNames") as AspNet.Label).Text;
|
||||
}
|
||||
// 处理CheckBox
|
||||
if (html.Contains("f-grid-static-checkbox"))
|
||||
{
|
||||
@@ -938,6 +942,99 @@ namespace FineUIPro.Web
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 导出方法
|
||||
/// </summary>
|
||||
/// <param name="grid"></param>
|
||||
/// <returns></returns>
|
||||
public static string GetGridTableHtml2(Grid grid)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.Append("<meta http-equiv=\"content-type\" content=\"application/excel; charset=UTF-8\"/>");
|
||||
sb.Append("<table cellspacing=\"0\" rules=\"all\" border=\"1\" style=\"border-collapse:collapse;\">");
|
||||
sb.Append("<tr>");
|
||||
|
||||
foreach (GridColumn column in grid.Columns)
|
||||
{
|
||||
if (column.ColumnID != "AttachFile" && column.ColumnID!= "lbfAction1" && column.ColumnID != "AttachFile2")
|
||||
{
|
||||
sb.AppendFormat("<td>{0}</td>", column.HeaderText);
|
||||
}
|
||||
}
|
||||
sb.Append("</tr>");
|
||||
foreach (GridRow row in grid.Rows)
|
||||
{
|
||||
sb.Append("<tr>");
|
||||
foreach (GridColumn column in grid.Columns)
|
||||
{
|
||||
if (column.ColumnID != "AttachFile" && column.ColumnID != "lbfAction1" && column.ColumnID != "AttachFile2")
|
||||
{
|
||||
string html = row.Values[column.ColumnIndex].ToString();
|
||||
if (column.ColumnID == "tfPageIndex" && (row.FindControl("lblPageIndex") as AspNet.Label) != null)
|
||||
{
|
||||
html = (row.FindControl("lblPageIndex") as AspNet.Label).Text;
|
||||
}
|
||||
if (column.ColumnID == "UnitWorkName" && (row.FindControl("lbUnitWorkName") as AspNet.Label) != null)
|
||||
{
|
||||
html = (row.FindControl("lbUnitWorkName") as AspNet.Label).Text;
|
||||
}
|
||||
if (column.ColumnID == "UnitName" && (row.FindControl("lbUnitName") as AspNet.Label) != null)
|
||||
{
|
||||
html = (row.FindControl("lbUnitName") as AspNet.Label).Text;
|
||||
}
|
||||
if (column.ColumnID == "UnitNames" && (row.FindControl("lbUnitNames") as AspNet.Label) != null)
|
||||
{
|
||||
html = (row.FindControl("lbUnitNames") as AspNet.Label).Text;
|
||||
}
|
||||
if (column.ColumnID == "tfNumber" && (row.FindControl("labNumber") as AspNet.Label) != null)
|
||||
{
|
||||
html = (row.FindControl("labNumber") as AspNet.Label).Text;
|
||||
}
|
||||
if (column.ColumnID == "tfTeamType" && (row.FindControl("lbTeamType") as AspNet.Label) != null)
|
||||
{
|
||||
html = (row.FindControl("lbTeamType") as AspNet.Label).Text;
|
||||
}
|
||||
if (column.ColumnID == "tfI" && (row.FindControl("tfI") as AspNet.Label) != null)
|
||||
{
|
||||
html = (row.FindControl("lbI") as AspNet.Label).Text;
|
||||
}
|
||||
if (column.ColumnID == "tfCompileMan" && (row.FindControl("tfCompileMan") as AspNet.Label) != null)
|
||||
{
|
||||
html = (row.FindControl("lblCompileMan") as AspNet.Label).Text;
|
||||
}
|
||||
if (column.ColumnID == "tfSpecialEquipmentId")
|
||||
{
|
||||
html = (row.FindControl("lblSpecialEquipmentId") as AspNet.Label).Text;
|
||||
}
|
||||
if (column.ColumnID == "CheckManNames")
|
||||
{
|
||||
html = (row.FindControl("lbCheckManNames") as AspNet.Label).Text;
|
||||
}
|
||||
// 处理CheckBox
|
||||
if (html.Contains("f-grid-static-checkbox"))
|
||||
{
|
||||
if (!html.Contains("f-checked"))
|
||||
{
|
||||
html = "×";
|
||||
}
|
||||
else
|
||||
{
|
||||
html = "√";
|
||||
}
|
||||
}
|
||||
sb.AppendFormat("<td style='vnd.ms-excel.numberformat:@;width:140px;'>{0}</td>", html);
|
||||
// sb.AppendFormat("<td>{0}</td>", html);
|
||||
}
|
||||
}
|
||||
|
||||
sb.Append("</tr>");
|
||||
}
|
||||
|
||||
sb.Append("</table>");
|
||||
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// DataTable转HTML
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user