Lotus notes LotusScript-多次提取和重新附加附件会导致第一个附件的副本和文件损坏

Lotus notes LotusScript-多次提取和重新附加附件会导致第一个附件的副本和文件损坏,lotus-notes,lotusscript,agent,lotus-formula,domino-designer-eclipse,Lotus Notes,Lotusscript,Agent,Lotus Formula,Domino Designer Eclipse,提取和重新附着单个文件会产生正确的结果,但当涉及多个文件时,结果是第一个附件的副本,但带有文件名的名称。 例如,如果我提取fileA.doc、fileB.doc和fileC.doc,我将得到fileA.doc、fileB.doc和fileC.doc,但文档中的内容将是fileA.doc的内容。文件名正确,但内容是第一个文档的内容,某些文件已损坏。 下面是相同的代码 strRtFieldName(0) ="Body1" strRtFieldName(1) ="Body2" strRtFieldNa

提取和重新附着单个文件会产生正确的结果,但当涉及多个文件时,结果是第一个附件的副本,但带有文件名的名称。 例如,如果我提取fileA.doc、fileB.doc和fileC.doc,我将得到fileA.doc、fileB.doc和fileC.doc,但文档中的内容将是fileA.doc的内容。文件名正确,但内容是第一个文档的内容,某些文件已损坏。 下面是相同的代码

strRtFieldName(0) ="Body1"
strRtFieldName(1) ="Body2"
strRtFieldName(2) ="Body3"
strRtFieldName(3) ="Body4"
strRtFieldName(4) ="Body5"
strRtFieldName(5) ="Body6"
strRtFieldName(6) ="Body7"
strRtFieldName(7) ="Body8"
strRtFieldName(8) ="Body9"
strRtFieldName(9) ="Body0"

varAttachmentNames = Evaluate("@AttachmentNames", doc) 

For i = 0 To UBound(varAttachmentNames)     
    ' check for attachment in Rich Text fields
    For k = 0 To 9
        Set rtitem = doc.Getfirstitem(strRtFieldName(k))
        If (object Is Nothing) Then
            If Not rtitem Is Nothing Then
                If (rtitem.Type = RICHTEXT) Then
                    Set object = rtitem.GetEmbeddedObject(varAttachmentNames(i))
                End If
            End If
        End If
    Next
    If (object Is Nothing) Then
        ' check for attachment in document
        Set object = doc.GetAttachment(varAttachmentNames(i))
    End If  
Next

如果您能指出代码的错误,我们将不胜感激。

查看
对象
变量,设置该变量后,将影响
if
语句。很明显,在第一个循环中,对象只是一无所有。因此,后续循环将重新使用相同的附件


我不知道为什么要用XPages标记它。

实际提取和重新附加的代码在哪里?另外:这里很难遵循您的逻辑,但有一点是肯定的:当您的代码进入for i循环时,object为Nothing,因此If-in-for k循环中的代码将执行;但是在fori循环的第二次迭代中,对象不会是空的,这样fork循环中的代码就不会执行。这似乎不可能是正确的。