I want to preview the current form and in the preview I can print it, how can I do this in lotus script?
You want to preview currently selected document in a view?
You could use view action that would run something like this:
Sub Click(Source As Button) Dim w As New NotesUIWorkspace Dim doc As NotesDocument Set doc = GetSelectedDoc() Call w.DialogBox(doc.form(0),True,True,True,True,False,True,"Put your title here",doc,True,True,False) End Sub Function GetSelectedDoc() As NotesDocument 'Mb¤, 04.04.2005 'The function returns currently selected document 'On Error Goto ErrHandler Dim s As New NotesSession Dim db As NotesDatabase Dim c As NotesDocumentCollection Set db = s.CurrentDatabase Set c = db.UnprocessedDocuments If c Is Nothing Then Exit Function Set GetSelectedDoc = c.getFirstdocument 'add your error handling End Function
See here for NotesUIWorkspace.DialogBox param explanation.
Or you can simply use @DialogBox formula:
@DialogBox( form ; [AUTOHORZFIT] : [AUTOVERTFIT] : [NOCANCEL] : [NONEWFIELDS] : [NOFIELDUPDATE] : [READONLY] : [SIZETOTABLE] : [NOOKCANCEL] : [OKCANCELATBOTTOM] : [NONOTE] ; title )
Notes is not really great for printing. Depending on your requirements you might be better off writing code to create a word document, which can then be printed. There are plenty of examples out there for achieving this and here is one of them to get you started: http://searchdomino.techtarget.com/tip/A-flexible-data-export-agent-for-Lotus-Notes
Hope this helps.
Create a subform with a read-only version of the form you want to print.
To preview the form - have the subform display in a Dialog box. Have dialog box set to inherit the values from main document.
On the subform display a print button that will print the read-only document. Have the print button hide when printed.
Have you tried to do a right click on the document? You might be able to print it by doing a right click. I would try the simple things first and see if this meets the user needs.
If you are talking about a workflow where you are handling documents and the process is complete and you want to preview the final document you should be able to do this via the UI Document Classes in either the java side or the NotesUI classes in LotusScript. Once you have a handle to the UIDocument you can do several things..
I would try setting the document to readonly and show it in the Preview pane if that object is in your UI design. You could then query the user if they want to print the document or not and use the UIDocument.print option.