2016-02-26 114 views
0

这可能是一个非常微不足道的问题,但我自己找不到解决方案。更改表格单元格中文字的字体

,所以我有如下一个表格单元格,我想在这上面文本更改为Courier字体

TableCell tableCell = new TableCell(); 
    tableCell.text = "1234" 

我已经试过这样:

tableCell.CssClass = "font: Courier"; 

我进去看了text和TableCell的字体属性。文本没有任何属性,TableCell的字体不允许我设置它的值。

Source 1Source 2

任何指导,非常感谢对服务器元素

回答

0

的CssClass不象是工作,你给它的类名在CSS

tableCell.CssClass = "CourierText"; 


//css 
    .CourierText { font: Courier; } 

回暖或者你可以添加个人规则,但班级是更好的做法

tableCell.Attributes["style"] = "font: Courier"; 

tableCell.Attributes.Add("style", "font: Courier"); 
相关问题