简体   繁体   English

NotesDocument将HotSpot /超链接添加为NotesRichtextItem

[英]NotesDocument Add HotSpot/Hyperlink as NotesRichtextItem

I am trying to add a link to a NotesDocument , which should have a displayname different from the actual link. 我正在尝试将链接添加到NotesDocument ,其显示名称应与实际链接不同。

How can I do this via C#-code? 如何通过C#代码执行此操作? I cannot use NotesMIMEEntity . 我不能使用NotesMIMEEntity

This is what I have done so far. 到目前为止,这是我所做的。 Bu I cannot figure out how to change the displayed tag of the link into Google for example 例如,我不知道如何将显示的链接标签更改为Google

NotesSession nSession = new Domino.NotesSession();
nSession.Initialize(pw);
NotesDatabase nDatabase = nSession.GetDatabase("SERVER", "names");                 
Domino.NotesDocument nDocument = nDatabase.CreateDocument(); 

nDocument.ReplaceItemValue("Subject", "Test"); 

NotesRichTextItem rtItem;                               
rtItem=  nDocument.CreateRichTextItem("Body");
rtItem.AppendText("http://google.com"); //I cannot see a "AppendLink" Method or sth. alike
nDocument.Send(false,"email@company.com"); 

Unfortunately, there's no way that I know of to do this with arbitrary links. 不幸的是,我不知道如何通过任意链接来做到这一点。 Not without either using MIME, which you've said you can't use, or DXL, or a 3rd party API like MIDAS. 不能不使用您曾经说过不能使用的MIME,DXL或MIDAS之类的第三方API。

But if you know in advance the exact link that you want to append, then the technique that I have used is to create a form for a configuration document with a key field and rich text field, which I'll call richTextLink. 但是,如果您事先知道要附加的确切链接,那么我使用的技术是为配置文档创建一个具有关键字段和富文本字段的表单,我将其称为richTextLink。 Manually create a document with this form, giving it the key LinkToGoogle, and use the Create - Hotspot (or Create - Hyperlink in Notes 9) to create your link in the rich text field. 使用此表单手动创建文档,并为其指定键LinkToGoogle,并使用“创建-热点”(或Notes 9中的“创建-超链接”)在富文本字段中创建链接。 Create a view for your config docs, with the first column sorted by the key field. 为您的配置文档创建一个视图,第一列按关键字段排序。 Then, in your code, open that view, use cfgDoc = view.getDocumentByKey("LinkToGoogle") to get the doc, then use linkRTItem = cfgDoc.getFirstItem("richTextLink") and rtItem.AppendRTItem(linkRTItem) . 然后,在您的代码中,打开该视图,使用cfgDoc = view.getDocumentByKey("LinkToGoogle")获取文档,然后使用linkRTItem = cfgDoc.getFirstItem("richTextLink")rtItem.AppendRTItem(linkRTItem)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM