描述
设置元素内容。
接口
bool SetElementContent(const char* id, const char* content, const char* json_str)
参数
参数名 |
必填 |
类型 |
说明 |
备注 |
id |
是 |
string |
元素ID |
为空时,设置对象为当前操作元素 |
content |
是 |
string |
元素内容 |
可以为纯文本,也可为带格式内容片段 |
json_str |
是 |
json str |
设置配置项 |
文档合并模式时使用 |
Json参数
参数名 |
必填 |
类型 |
说明 |
备注 |
srcDocName |
否 |
string |
指定源文档名 |
文档合并模式时,可以使用本配置修改指定子文档的对应Id元素的内容 |
返回值
类型 |
说明 |
备注 |
bool |
设置是否成功 |
1:设置成功 0:设置失败 |
代码示例
- 设置带格式内容
ThinkEditor.SetElementContent("ele_id",'<Fragment><Format size="0.776" />带格式内容</Fragment>');
- 设置纯文本内容
ThinkEditor.SetElementContent("ele_id",'新内容');
文档更新时间: 2025-02-25 22:14 作者:admin