二开插件:富文本控件赋值
- 其它内容可以参考帖子:https://wenku.my7c.com/article/383666891215911424?productLineId=1&isKnowledge=2
- 富文本控件数据库存储是字节数组的格式,所以赋值的时候也要用字节数组赋值。
- 富文本控件必须要按照html格式解析,所以需要先组装为html文本再转字节数组进行赋值。
### 如下示例,将普通文本赋值到富文本字段
```C#
/// <summary>
/// 公共函数:普通字符串转富文本html,微软雅黑/一行
/// </summary>
/// <param name="txt"></param>
/// <returns></returns>
public static byte[] GetRichValue(string txt)
{
if (string.IsNullOrWhiteSpace(txt)) { return new byte[0]; }
string headStr = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\"><html xmlns =\"http://www.w3.org/1999/xhtml\"><head><meta http-equiv =\"Content-Type\" content=\"text/html; charset=utf-8\" /><title></title ><style type =\"text/css\"> .cs2654AE3A{ text-align:left; text-indent:0pt; margin: 0pt 0pt 0pt 0pt} .cs3395C1D9{color:#000000;background-color:transparent;font-family:Microsoft YaHei UI;font-size:12pt;font-weight:normal;font-style:normal;}</style></head><body>
"; string endStr = "
</body></html>"; return Encoding.UTF8.GetBytes(headStr + txt + endStr); } public override void AfterBindData(EventArgs e) { // 富文本字段赋值-微软雅黑、单行 this.View.Model.SetValue("F_UJEB_XXXX", GetRichValue("测试文本文本测试")); } ```二开插件:富文本控件赋值
- 其它内容可以参考帖子:https://wenku.my7c.com/article/383666891215911424?productLineId=1&isKnowledge=2- 富文本控件数据库存储是...
点击下载文档
上一篇:计算日期期间下一篇:损耗的业务财务处理/业务处理
本文2024-09-16 18:14:22发表“云星空知识”栏目。
本文链接:https://wenku.my7c.com/article/kingdee-k3cloud-20847.html
您需要登录后才可以发表评论, 登录登录 或者 注册
最新文档
热门文章