本文介绍了通过lotusscript更新文件中的签名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好。我是lotusscript的新手,我想在每次创建新邮件时更新html文件中的签名富文本,我可以访问该文件。因此,当我自动更改html文件时,它将更改签名。我在代码下面尝试了Message表单的onload事件,但没有运气。我使用Domino Designer 8.5。我也尝试在CalendarProfile表单中加载它,但在表单关闭后,任何更改都会丢失。

 Sub Onload(来源为Notesuidocument)
'************************ *********************************
'从html文件刷新签名,如果文件可用
'*********************************************** **********
如果source.IsNewDoc那么
Dim session As New NotesSession

'打开用户邮件数据库
设置dbMail = session。 CurrentDatabase

如果不是dbMail.IsOpen那么
调用dbMail.OpenMail
结束如果

设置docProfile = dbMail.GetProfileDocument(CalendarProfile)

'检查文件是否存在
如果不是Dir $(mypath\fileName.html,0)=那么

设置workspace = CreateObject(Notes .NotesUIWorkspace)
调用workspace.EditDocument(True,Source)
设置curDoc = source.Document

Dim tmpRich As New NotesRichTextItem(curDoc,Signature_Rich)

调用source.GotoField(Signature_Rich)
调用source.Import(HTML文件,mypath \ fileName.html)'//似乎导入不存在。
设置newRich = curDoc.GetFirstItem(Signature_Rich)

Dim richTextItem As New NotesRichTextItem(docProfile,Signature_Rich)
调用richTextItem.AppendRTItem(newRich)
'调用richTextItem.AppendText(test)
调用docProfile.Save(True,False)
结束如果
结束如果
结束子
解决方案

Hello. I'm new in lotusscript and I want to update signature rich text from html file every time when I create new mail and I can acces the file. So when I will change html file automatic it will change signature. I have tryed in onload event of Message form below code, but not luck. I use Domino Designer 8.5. I have try also load it in CalendarProfile Form, but after form closing any change lost.

Sub Onload(Source As Notesuidocument)
'*********************************************************
'Refresh Signature from html file and if file is aviable
'*********************************************************
If source.IsNewDoc Then
    Dim session As New NotesSession

    'Open users mail database
    Set dbMail = session.CurrentDatabase

    If Not dbMail.IsOpen Then
        Call dbMail.OpenMail
    End If

    Set docProfile = dbMail.GetProfileDocument("CalendarProfile")

    'Check if file exist
    If Not Dir$( "mypath\fileName.html", 0 ) = "" Then

        Set workspace = CreateObject("Notes.NotesUIWorkspace")
        Call workspace.EditDocument(True, Source)
        Set curDoc =  source.Document

        Dim tmpRich As New NotesRichTextItem( curDoc , "Signature_Rich" )

        Call source.GotoField("Signature_Rich")
        Call source.Import("HTML File", "mypath\fileName.html") '// seems that Import does not exist.
        Set newRich= curDoc.GetFirstItem("Signature_Rich")

        Dim richTextItem As New NotesRichTextItem( docProfile , "Signature_Rich" )
        Call richTextItem.AppendRTItem (newRich)
        'Call richTextItem.AppendText ("test")
        Call docProfile.Save(True, False)
    End If
End If
End Sub
解决方案


这篇关于通过lotusscript更新文件中的签名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-24 18:33
查看更多