I have an idea and wonder if anyone has done this or if it is possible. In a form [FormA] I want to use the mouse and highlight a block of text in the MeetingText rich text field then I would like to press a [create action item] button to open a new [Action] form and copy just the highlighted text automatically from the MeetingText field of FormA to the MeetingTask field of the Action form. I am looking at LotusScript and trying to figure out how to copy just the selected text, any ideas??, thanks… brian
Subject: RE: Highlight text & create child document
Did you look at the GetSelectedText method ?
Subject: RE: Highlight text & create child document
I was just looking at this, I have not created the code for the button so I wondered if this worked with RichText and if the UIDoc needed to be saved before I called this method, yes dumb question because I know it does. thanks…
Subject: RE: Highlight text & create child document
I haven’t tried it specifically. I would expect you do not need to save the document before calling GetSelectedText – can’t think of any reason this might be the case – but of course you can’t create a response to a document that has never been saved, since it doesn’t have a final UNID.
Subject: RE: Highlight text & create child document
Opps, sorry for the confusion, I do have this working the problem I have is just with the formatted RichText. I want to copy just the selected RichText from the body field of FormA and paste it into the Body field of the Action form. I can copy now but the text that is pasted in does not retain the formatting, e.g. returns, spacing, etc.
Subject: RE: Highlight text & create child document
Ah. You didn’t say anything about formatting before. I guess you’ll have to use the NotesUIDocument methods or formula commands to actually copy and paste the text, then.
Subject: Highlight text & create child document
where are you going to put the “Create Action Item” button?
Subject: RE: Highlight text & create child document
It would be somewhere on the [FormA] form that I am highlightingh the text on. My guess is I have to save the current UIDoc first then open a responce doc using the [Action] form from the current UIDoc.
Subject: RE: Highlight text & create child document
well you cannot put a button on the form because if you highlight the text then click the button the focus will go to the button and the selected text will no longer be selected. If you use an action bar button I think the focus will remain on the highlighted text. In that case you should be able to use the Copy or GetSelectedText method as Andre suggests.
Subject: RE: Highlight text & create child document
Thanks Paul, I have the code in an Action Button, the problem I have is selecting RichText and maintaining the formatting when it is pasted in the new form. I am using GetSelectedText but it is stored as a string without formatting, unless I am doing something wrong.
Subject: RE: Highlight text & create child document
post your code
Subject: RE: Highlight text & create child document
Here is the code, it creates the ‘action’ form and puts the text in the Body field, my problem seems to be in the GetSelectedText method, the text returns seems to be just a string and does not retain the richText formatting.
Sub Click(Source As Button)
On Error Goto ProcessError
Dim workspace As New NotesUIWorkspace
Dim doc As NotesDocument
Dim uidoc As NotesUIDocument
Dim nuidoc As NotesUIDocument
Dim text As String
Dim fieldName As String
Dim itemBody As NotesRichTextItem
fieldName = "Subject"
Set uidoc = workspace.CurrentDocument
'Check to see if we need to save the doc
If uidoc.IsNewDoc Then
Call uidoc.Save
End If
'Need to copy the selected rich text but this does not maintain formating.
text = uidoc.GetSelectedText("Body")
If text <> "" Then
Set nuidoc = workspace.ComposeDocument("","","Action")
Call nuidoc.FieldAppendText ( "Body", text )
'The rest below is just some other stuff I tried
'Set doc = nuidoc.Document
'Set itemBody = New NotesRichTextItem(doc, "Body")
'Call nuidoc.FieldSetText("Body", text)
'Call doc.GotoField( "Body" )
'Call doc.InsertText( text )
'Call uidoc.FieldSetText("Subject", text)
'Call nuidoc.Save
'Call doc.Save(True, False)
'Call nuidoc.Close
Else
Messagebox "Please Highlight / Select text you would like to create an action item from"
End If
Exit Sub
ProcessError:
Messagebox "Error " & Err() & ": " & Error()
Exit Sub
End Sub
Subject: RE: Highlight text & create child document
Try using the Copy Method and Paste Method