lotus-noteslotusscript

Lotusscript : Can I detect picture in rich text field?


I have a problem with my program that because my user like to attach the screen-capture picture into rich-text field

ex.

enter image description here

And my program can not detect them...

enter image description here

Can everyone share your idea ?...

thank you.


Solution

  • Consider using NotesRichTextNavigator for your rich text field. Obtain the navigator via

    Set notesRichTextNavigator  =  notesRichTextItem .CreateNavigator 
    

    Then for notesRichTextNavigator object, use FindFirstElement and FindNextElement calls to examine rich text field contents for particular element types.

    Check the navigator class API reference here: https://www.ibm.com/support/knowledgecenter/en/SSVRGU_9.0.1/basic/H_NOTESRICHTEXTNAVIGATOR_CLASS.html


    UPDATE

    I have checked some things with Notes Designer and I have to say the following.

    Navigator approach described above is not suitable to check for pictures pasted to the rich text field. Standard notes functionality does not allow to check whether a rich-text item contains an embedded picture object.

    Neither notesDocument.HasEmbedded nor richtextItem.EmbeddedObjects show contained embedded pictures.

    But described way is possible to control file attachments, ole objects and document links according to the API specification.

    Please note, if you are working with a notesDocument which was not saved, i.e it is a new document, you should call notesUIDocument.Refresh(true) to pass rich text item from front-end UI document to back-end notesDocument. Otherwise getFirstItem(richTextFieldName) will return Nothing.