Manage Learn to apply best practices and optimize your operations.

Printing the current document with another form from LotusScript

This tip describes how to print the current document with another form from LotusScript.

Did you ever try to print a document that is currently edited with another form from inside LotusScript? For example, if you provide a button to print part of the document with another formatting than what is currently on screen. Yes, power-user can do that by navigating the menus, but that is usually not the comfort your users expect from your application. Unfortunately, uidoc.print does not allow specifying the form to be used. And, setting the form-field on the document does not help either. There is a solution for this problem, even not that nice as you would wish for, but it works: After changing the form by setting the form-field on the document, you have to open the document in a new window, where it is using the changed form, print it, and close the window, and you are back in the window, where you have started>


Dim workspace As New 
NotesUIWorkspace
Dim uidoc As NotesUIDocument
Dim Doc As NotesDocument
Dim OldFormName As String

Set uidoc = workspace.CurrentDocument
Call uidoc.refresh
Set Doc=uidoc.Document
OldForm=Doc.Form(0)

doc.Form="SpecialFormNameToBeUsed"
Call workspace.EditDocument(False,Doc)
Set uidoc=WorkSpace.CurrentDocument
Call uidoc.Print( 1 )
Call uidoc.close

Doc.Form=OldForm

  

Dig Deeper on LotusScript

SearchWindowsServer

Search400

  • Favorite iSeries cheat sheets

    Here you'll find a collection of valuable cheat sheets gathered from across the iSeries/Search400.com community. These cheat ...

  • HTML cheat sheet

    This is a really cool cheat sheet if you're looking to learn more about HTML. You'll find just about everything you every wanted ...

  • Carol Woodbury: Security

    Carol Woodbury

SearchDataCenter

SearchContentManagement

Close