如何在DataGridView中渲染Html文本? [英] How Can we Render Html text in DataGridView?

查看:211
本文介绍了如何在DataGridView中渲染Html文本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



但我的datagridview不是formet html文本。



exp:

  string htmltext =< p>在这里的某些文本< / p> ;; 
dgrow.rows [0] .cell [1] .value = htmltext;

在这种情况下,我的gridview的单元格值也包含Html标签。
所以我如何在网格视图中格式化HTML文本?

解决方案

我最近还要求HTML WinForms DataGridView控件中的文本。



像你一样,我找不到任何符合我需求的东西,创建了我自己的DataGridViewHTMLCell自定义类。



您可以在这里找到代码和示例项目: https: //github.com/OceanAirdrop/DataGridViewHTMLCell


I have html text data and i want to bind this data in my gridview cell.

but my datagridview is not formet html text.

exp:

string htmltext = "<p>hi some text here</p>";
dgrow.rows[0].cell[1].value=htmltext;

In this case cell value of my gridview is contain Html tag also. so how can I format Html Text in my grid view?

解决方案

I also recently had the requirement to render HTML text in a WinForms DataGridView control.

Like you I couldnt find anything out there that fitted my needs so created my own custom DataGridViewHTMLCell class.

You can find the code and sample project here: https://github.com/OceanAirdrop/DataGridViewHTMLCell

这篇关于如何在DataGridView中渲染Html文本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆