Notes UIDoc reopen without saving the underlying document
Daniel Nashed – 23 February 2023 21:48:20
I am working on a form that has embedded passthru HTML to display in-line base64 encoded image data from a text field (don't ask why ..).
The image did not always display immediately. So I tried all kind of refresh and reload options without any luck.
Until I found an example in the Notes help which does exactly what I need.
I tried to tweak and simplify it without any good result.
It only works with this exact sequence of events for me.
Now let the crow wisdom find an easier, but still reliable way.
I am pretty happy with this already.
- The SaveOptions = "0" force the UIDoc not to ask to be saved
- Then we are closing the UI doc.
- Creating a new instance of it
- Delete the previous UI doc
- Finally remove the SaveOptions item from the uidoc.document ...
Every attempt to simplify it, failed. But this is great to have and works like a charm.
-- Daniel
doc.SaveOptions = "0"
Call uidoc.Close (True)
Set uidoc_new = workspace.EditDocument (True, doc, , , , True)
Delete uidoc
Call uidoc_new.Document.RemoveItem ("SaveOptions")
- Comments [3]
1Bob Voith 24.02.2023 12:06:05 Notes UIDoc reopen without saving the underlying document
Cool!
2Andre Guirard 10.03.2023 1:35:18 Notes UIDoc reopen without saving the underlying document
I like to also restore the position in the document if I can, like this:
Function RedisplayDoc(uidoc As NotesUIDocument, doc As NotesDocument) As NotesUIDocument
On Error Goto errortrap
Dim strFieldname As String
Dim wksp As New NotesUIWorkspace
strFieldname = uidoc.CurrentField ' remember current field if any
doc.SaveOptions = "0" ' make it possible to close the document
' without a "do you want to save" prompt.
Call uidoc.Close(True)
Set RedisplayDoc = wksp.EditDocument(True, doc, , , , True)
Delete uidoc
RedisplayDoc.Document.RemoveItem("SaveOptions")
If strFieldname <> "" Then RedisplayDoc.GotoField(strFieldname)
' return focus to field that was current before.
Exit Function
errortrap:
Error Err, Error & " //RedisplayDoc:" & Erl
End Function
3Daniel Nashed 12.03.2023 23:00:02 Notes UIDoc reopen without saving the underlying document
Hi Andre!
Thanks, for this great addition.
The command in general is already quite helpful and I was surprised about this sulution.
But it really helpful. I have used it in two databases already.
-- Daniel