C#TableCell格式文本或渲染HTML

时间:2013-05-28 11:40:06

标签: c# html text subscript tablecell

对表格进行硬编码,其中单元格显示R max ,并以“max”作为下标。

TableCell c = new TableCell();
c.Text = "R<sub>max</sub>";

但结果是R< sub> max< / sub> (没有空格 - 抱歉,糟糕的全面阻止它在这篇文章中渲染)

正确的文字,错误的渲染。另外,我想使用CSS来控制字体等。

1 个答案:

答案 0 :(得分:0)

尝试

c.Text = "R<sub>max</sub>"

更新:

string html = "R&lt;sub&gt;max&lt;/sub&gt;";
html = System.Web.HttpUtility.HtmlDecode(html);
Response.Write(html);
相关问题