二开插件:富文本控件赋值

栏目:云星空知识作者:金蝶来源:金蝶云社区发布:2024-09-16浏览:1

二开插件:富文本控件赋值

- 其它内容可以参考帖子: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- 富文本控件数据库存储是...
点击下载文档
确认删除?
回到顶部
客服QQ
  • 客服QQ点击这里给我发消息