Signature above Bodytext :-(

Need Help,

I have a document with some information (pdf-filename, mailaddress, some Text in body field…)

The user has to click on a button which downloads the pdf, creates new memo and attaches the pdf. The memo’s body field contains the same text as the body field of the document.

Now the problem: The signature which is added automatically (tools/mail preferences) is above the text I copied from the document’s body item.

Thanks 4 help.

some lines of code:

Dim DocBody As NotesRichtextItem

Set DocBody = doc.GetFirstItem(“Body”)

Dim BodyItem As New NotesRichtextItem (memo, “Body”)

Call Memo.CopyItem(DocBody, “Body”)

Set PDF_Att = BodyItem.EmbedObject _

          (EMBED_ATTACHMENT,"",PDFPath)

	Kill (PDFPath)

Memo.Form = “memo”

Memo.SendTo = SendTo

'Memo.CopyTo = CopyTo

Memo.Subject = Subject

Call wksp.EditDocument(True, Memo)

Subject: RE: Signature above Bodytext :frowning:

Wait to add stuff until after EditDocument.

Set uidocMemo = wksp.EditDocument(True, Memo)

Call uidocMemo.Refresh(true)

Set Memo = uidocMemo.Document

Set bodyMemo = Memo.GetFirstItem(“Body”)

Set rtnav = bodyMemo.CreateNavigator

rtnav.FindFirstElement RTELEM_TYPE_TEXTPARAGRAPH

bodyMemo.BeginInsert rtnav

bodyMemo.AppendRTItem DocBody

bodyMemo.EndInsert

Subject: RE: Signature above Bodytext :frowning:

the idea to insert my stuff later sounds good.

But I can’t set the rtnav - debugger says it is empty. → Error message: element or navigator is empty.

I also have a problem with the True-parameter on the uidoc.refresh → Error message: only plain text can be used in this type of field

Subject: Andre is on the right lines

Max Flodén has provided some code to suppress the auto signature

http://www.tjitjing.com/blog/2006/05/lotusscript-body-above-signature-in.html

for bonus points, here’s some code to re-insert the signature after you have opened the memo for editing

With mailUiDoc

	REM: kludge to move cursor to the end

	Call .GotoField("Body")

	Call .selectAll

	Call .cut

	Call .paste

End With



REM: re-insert signature

Dim sigOption As String

sigOption = docProfile.SignatureOption(0)

If sigOption = "1" Then 'text

	Call mailUiDoc.FieldAppendText("Body", docProfile.Signature_1(0))

Elseif sigOption = "2" Then		'file

	Dim filePath, extension, fileFilter As String

	filePath = docProfile.Signature_2(0)

	extension  = Right(filePath, Len(filePath) - Instr(filePath, "."))

	Select Case extension

	Case "jpeg", "jpg":

		fileFilter = "JPEG Image"

	Case "gif":

		fileFilter = "GIF Image"

	Case "bmp":

		fileFilter = "BMP Image"

	Case "htm", "html":

		fileFilter ="HTML File"

	Case "txt":

		fileFilter ="ASCII Text"

	End Select

	Call mailUiDoc.Import(fileFilter,filePath)

End If

Subject: RE: Andre is on the right lines

I’ve tried this

With mailUiDoc

REM: kludge to move cursor to the end

Call .GotoField(“Body”)

Call .selectAll

Call .cut

… import html signature into uidoc …

Call .paste

End With

and it crashes the notes client (V. 7.0.3) if the body already contains a file attachment. Is there any chance to insert a html signature if the body contains already an attachment?

Bye

Johannes

Subject: RE: Signature above Bodytext :frowning:

I considered entering a change request to have the signature automatically inserted at the bottom, but I’m afraid that would mess up other functions – forwarding, for instance, needs to hae the signature at the top.

Here’s another idea. Look at the memo code to figure out what information in the user’s profile document tells the memo form to have the signature inserted. Temporarily modify the profile document to not insert a signature. Open the new memo. Then restore the profile (since the profile is cached, you may even be able to avoid modifying it by simply not saving the original change, and using Delete to remove it from cache). If you want to get fancy you could copy the code from the mail template that inserts the automatic signature, and have your code insert it at the end.

Or. perhaps there’s some form field the code looks at to exempt a memo from having a signature inserted.

Subject: RE: Signature above Bodytext :frowning:

Sorry – no other ideas. I guess you could design your own Memo form in the application and have it insert the signature after existing contents.