简体   繁体   English

在DataTable中制作粗体字体?

[英]Make Bold Font in DataTable?

I add dynamic row in DataTable.I need to bold the "Total" in Bold.How to do this? 我在DataTable中添加了动态行。我需要将Bold中的“总计”加粗。如何执行此操作?

DataTable dt = new DataTable();
dt.Rows.Add(new object[] { "", "Total", "valuehere"});

Typically text formatting is done wherever the code for displaying the text is. 通常,文本格式化是在显示文本的代码所在的任何地方进行的。 A string does not contain that sort of formatting information usually. 字符串通常不包含这种格式信息。

Carlos is right. 卡洛斯是对的。

At the max you can try getting your text from database with tag as follows, which might help you. 您最多可以尝试按如下所示从数据库获取带有标签的文本,这可能会对您有所帮助。

DataTable dt = new DataTable();
dt.Rows.Add(new object[] { "", "<b>Total", "<b>valuehere"});

You can bold the Object in which you are displaying this datatable values. 您可以加粗显示该数据表值的对象。

Eg. 例如。 Label, gridviewcells,etc 标签,gridviewcells等

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM