/// <summary> /// 获取HTML表示形式 /// </summary> /// <returns></returns> protected override string OnGetHtmlString() { StringBuilder sb = new StringBuilder(); MdTable mdTable = (MdTable)this.ParentBlock; sb.Append("<tr>"); for (int i = 0; i < this.Children.Count; i++) { var md = this.Children[i]; string align = null; if (mdTable.Children.Count >= 2) { MdTableAlign mdTableAlign = (MdTableAlign)mdTable.Children[1]; if (mdTableAlign.Children.Count > i) { align = mdTableAlign.Children[i].ToString(); } } if (align.IsNoneOrNull()) { sb.AppendFormat("<th>{0}</th>", md.ToHtml()); } else { sb.AppendFormat("<th align=\"{0}\">{1}</th>", align, md.ToHtml()); } } sb.Append("</tr>"); return(sb.ToString()); }
/// <summary> /// 获取HTML表示形式 /// </summary> /// <returns></returns> protected override string OnGetHtmlString() { StringBuilder sb = new StringBuilder(); MdTable mdTable = (MdTable)this.ParentBlock; sb.Append("<tr>"); for (int i = 0; i < this.Children.Count; i++) { var md = this.Children[i]; sb.AppendFormat("<td>{0}</td>", md.ToHtml()); } sb.Append("</tr>"); return(sb.ToString()); }