Lotusscript 富文本字段将图像或 Unicode 字符添加到富文本表

问题描述 投票:0回答:2

是否有任何方法可以在 LotusScript 生成的表格中添加 Wingdings 中的图像或 unicode 字符。

由于 LotusScript 中表格格式设置的选项有限,我将格式化表格存储在配置文件文档中,并将其附加到富文本字段。

在文档的 Queryopen 事件中,我添加 rtf 表并添加行并填充。下面的示例是查找从文档发送的电子邮件并将其以 RTF 格式显示在该文档中 非常感谢任何帮助。

Sub Queryopen(Source As Notesuidocument, Mode As Integer, Isnewdoc As Variant, Continue As Variant)

    Dim session As New NotesSession
    Dim ws As New NotesUIWorkspace  
    Dim rtItem As NotesRichTextItem
    Dim rtnavBody As NotesRichTextNavigator
    Dim rtt As NotesRichTextTable
    Dim rc As Integer
    Dim cc As Integer 
    Dim rcc As Integer
    Dim cl As Integer
    Dim richStyle As NotesRichTextStyle
    Dim tablelayout As NotesRichTextItem 
    Dim db As NotesDatabase 
    Dim pdoc As NotesDocument
    
    On Error Goto errorsub
    
    Set uidoc = source
    Set db =session.CurrentDatabase
    Set doc = uidoc.Document
    
    Set view = db.Getview("MailByParentID")
    Set col = view.Getalldocumentsbykey(doc.DocID,True)

    
    If col.count=0 Then Exit Sub    'No items exist so no point in carrying on.
End If

Set rtItem = New NotesRichTextItem(doc,"rtfCustMail") 'field in the current document
Set pdoc=db.Getprofiledocument("Profile Doc")
Set tablelayout = pdoc.GetFirstItem("rtfMailLog") 'Get a ready made table from the Profile Doc.
Call rtitem.AppendRTItem(tablelayout)
Set rtnavBody = rtItem.CreateNavigator
Set richStyle = session.CreateRichTextStyle
Set idoc = col.Getfirstdocument()
            'Add a row to the table to hold the data for the first item in the order    
Call rtnavBody.FindFirstElement(RTELEM_TYPE_TABLE)
Set rtt = rtnavBody.GetElement  


Do Until idoc Is Nothing
    Call rtt.AddRow()
    
        'Write the item data into the tablecells -- 
    rc%= rtt.RowCount           'Find the number of rows in the table
    cc% =rtt.ColumnCount            
    rcc% =rc%*cc%               'Calculate total number of table cells
    cl% =rcc%-5             'Calculate cell number of the first cell in the new (last) row
    
    Call rtnavBody.FindNthElement(RTELEM_TYPE_TABLECELL,cl%)    'Move to the first cell in the last row 
    Call rtitem.BeginInsert(rtnavBody)
    Call rtitem.Appenddoclink(idoc,"")
    Call rtitem.EndInsert
    
    Call rtnavBody.FindNextElement(RTELEM_TYPE_TABLECELL)
    Call rtitem.BeginInsert(rtnavBody)
    Call rtitem.AppendText(******need to add characters in here or better still images.)
    Call rtitem.EndInsert
   'To      
    Call rtnavBody.FindNextElement(RTELEM_TYPE_TABLECELL)
    Call rtitem.BeginInsert(rtnavBody)
    Call rtitem.AppendText(idoc.SendTo(0))
    Call rtitem.EndInsert   
    
    etc etc.

    Set idoc = col.Getnextdocument(idoc)
Loop    

errorsub: Print " Line " Erl & " Reason - "& Error$ 

End Sub
lotus-notes lotusscript
2个回答
0
投票

Unicode 字符可以简单地作为文本附加。由于 Notes 使用的是 LMBCS,而不是 Unicode,因此存在一些复杂性。不过,如果您可以将所需的字符粘贴到 LotusScript 代码中的文本字符串中,则转换将在幕后完成。如果有任何问题,我在 10 到 20 年前的某个时间在 OpenNTF 网站上上传了一个 NSF,其中包含所有 Unicode 字符及其 LMBC 等效项的完整列表。如果在 OpenNTF 进行各种更改后不再找到它,我仍然有一份副本。

顺便说一句,我发现了一个非常有用的技巧,可以将内容放入 NotesRichText 项目中,该项目是从您已经预先构建的部分动态构建的,即 AppendToRTItem 方法。即,您正在构建 rtitem,如上所述。您有一个配置文档,其中包含一个富文本字段,其中包含您想要的内容(例如,图像、超文本链接、带有隐藏时间公式的内容等),因此您打开该配置文档,从中获取 NotesRichText 项将文档写入 rtitem2,然后调用

rtitem2.AppendToRTItem(rtitem)


0
投票

也许这就是方法?

让 OpenLog 条目更加生动一点

https://quintessens.wordpress.com/2022/09/28/making-openlog-entries-a-bit-more-lively/

© www.soinside.com 2019 - 2024. All rights reserved.