Lotus notes NotesRichTexItem:在现有富文本数据的第一个位置插入文本字符串
我想将文本字符串插入数据库中所有文档的第一个位置的现有富文本字段数据中。 NotesRichTextNavigator.FindFirstElement方法-此方法需要指定要搜索的元素类型,但我只需在富文本数据的第一个位置插入文本。Lotus notes NotesRichTexItem:在现有富文本数据的第一个位置插入文本字符串,lotus-notes,lotus-domino,Lotus Notes,Lotus Domino,我想将文本字符串插入数据库中所有文档的第一个位置的现有富文本字段数据中。 NotesRichTextNavigator.FindFirstElement方法-此方法需要指定要搜索的元素类型,但我只需在富文本数据的第一个位置插入文本。 这可能是一个非常基本的问题,但我找不到路,浪费了几个小时。。。请帮帮我 您可以使用变通方法来实现这一点。不使用FindFirstElement,而是创建一个伪richtextitem,其中包含需要在原始项前添加的文本, 将原始项添加到虚拟项,删除原始项并重新创建它。
这可能是一个非常基本的问题,但我找不到路,浪费了几个小时。。。请帮帮我 您可以使用变通方法来实现这一点。不使用FindFirstElement,而是创建一个伪richtextitem,其中包含需要在原始项前添加的文本, 将原始项添加到虚拟项,删除原始项并重新创建它。 然后添加虚拟项并删除虚拟项 这听起来很复杂,但实际上并不难。下面是LotusScript中的一个小示例,介绍如何在文档上执行此操作:
'Get your richtext field
Set rtf = doc.getfirstItem("myRTF")
'create the dummy
Set rtDummy = doc.Createrichtextitem("rtfDummy")
'set the text that you want to insert in your richtext field
Call rtDummy.appendText("Inserting a line of text at the top")
'Add a line to make sure the inserted text is on a separate paragraph
Call rtDummy.Addnewline(1, true)
'Add the content of the original richtext item
Call rtDummy.Appendrtitem(rtf)
'Remove the original item and recreate it
Call rtf.Remove()
Set rtf = doc.Createrichtextitem("myRTF")
'Append the dummy item (including the added text)
Call rtf.Appendrtitem(rtDummy)
'Remove the dummy item
Call rtDummy.Remove()
'Save the document
Call doc.Save(True, True)
您可以使用变通方法来实现这一点。不使用FindFirstElement,而是创建一个伪richtextitem,其中包含需要在原始项前添加的文本, 将原始项添加到虚拟项,删除原始项并重新创建它。 然后添加虚拟项并删除虚拟项 这听起来很复杂,但实际上并不难。下面是LotusScript中的一个小示例,介绍如何在文档上执行此操作:
'Get your richtext field
Set rtf = doc.getfirstItem("myRTF")
'create the dummy
Set rtDummy = doc.Createrichtextitem("rtfDummy")
'set the text that you want to insert in your richtext field
Call rtDummy.appendText("Inserting a line of text at the top")
'Add a line to make sure the inserted text is on a separate paragraph
Call rtDummy.Addnewline(1, true)
'Add the content of the original richtext item
Call rtDummy.Appendrtitem(rtf)
'Remove the original item and recreate it
Call rtf.Remove()
Set rtf = doc.Createrichtextitem("myRTF")
'Append the dummy item (including the added text)
Call rtf.Appendrtitem(rtDummy)
'Remove the dummy item
Call rtDummy.Remove()
'Save the document
Call doc.Save(True, True)