Solved

I need to print some Documents from LotusScript using alternative forms - can this be done?

Posted on 2007-04-10
10
1,408 Views
Last Modified: 2013-12-18
I have developed an order management system using Lotus Notes/Domino R7.0.1, & have been asked to provide a button that prints out a load of Documents of a certain status. When discussing these changes with the client, I didn't foresee a problem, but looking at the documentation, it seems to me that LotusScript is not over endowed with printing functionality, to say the least.

I expected to have no way of selecting a printer or changing the default printer, and I wasn't disappointed there, but I was expecting that I could either open or print a Document using an alternative Form, but neither NotesUIWorkspace.EditDocument() nor NotesUIDocument.Print() take an argument for an alternative Form. Never mind, I thought, I'll just get a NotesUIDocument from a NotesDocument from a View with a Form Formula set, but having tried this, it just completely ignores the Form Formula, using the 'normal' Form instead.

I've always thought it a really powerful feature of Notes that it can display Documents using alternative Forms, but what good is it if you can't print them out?

Do I really have to edit each Document, change the Form Field to the Form I want to print using, print the Document, then change the Form Field back again? Is there really no better way to do this? This would be a horrid solution - what if the Agent doesn't complete? Then you'll be left with some Documents that have the Form field set incorrectly, which would probably mean they wouldn't even appear in the right Views!

Just before posting this question, I've just found NotesUIView.Print(), which does have a formOverride parameter, so maybe I can use this? I guess I'd have to create a Folder (which from LotusScript's perpective is the same as a View), add the various documents I want printed to this Folder, then issue a UI Select All command, then use the NotesUIView.Print() method specifying the alternative form as one of the parameters, then finally remove all the Documents from the Folder. Whilst this might actually work, all this is going to happen on the screen & seems a bit messy - can anyone think of a better idea, or even confirm whether this idea will work?

Any thoughts or comments gratefully received.
0
Comment
Question by:PaulCutcliffe
  • 5
  • 4
10 Comments
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 18884509
I can only offer my standard panacea for printing things from Script: www.notestopaper.com But probably you don't want 3rd party products, or you don't want to pay for them, or they are too expensive... By the way, there are other, similar products (e.g. Midas), but I used NotesToPaper and I know it works. Say hi to Peter Hoffmann from me when you contact them ;-)
0
 
LVL 63

Expert Comment

by:SysExpert
ID: 18885151
0
 

Author Comment

by:PaulCutcliffe
ID: 18889272
sjef bosman: As you suspected, using third party software isn't an option for this Agent.

SysExpert: Interesting reading, but not really applicable here.

I will pursue the Folder/NotesUIView.Print() idea I outlined in my original question & report progress back here - please feel free to comment/contribute...
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 46

Accepted Solution

by:
Sjef Bosman earned 250 total points
ID: 18889409
I "know" CRAK had a solution to this problem, but I have yet to find it.  It could have been this one: http://www.experts-exchange.com/Software/Office_Productivity/Office_Suites/Lotus_SmartSuite/Lotus_Notes/Q_21245371.html but I'm not sure...
0
 

Author Comment

by:PaulCutcliffe
ID: 18889673
Actually, qwaletee's solution was quite useful - I may see if I can incorporate some of this ideas.

Watch this space...
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 18889860
I'm all eyes!!!
0
 

Author Comment

by:PaulCutcliffe
ID: 18890971
Well the NotesUIView idea is out the window, as I've just realised you can't get hold of a NotesUIView unless the user opens it themselves.

The documentation provides two examples - one shows code in one of the View UI Events, & the other uses NotesUIWorkspace.CurrentView.

So I'm going to use an idea seen in qwaletee's solution where the form field of the open NotesUIDocument is changed just before printing.
0
 

Author Comment

by:PaulCutcliffe
ID: 18891143
Got it! When I open the Document, I open it in Read mode with the ReadOnly flag set, so I can't edit it once it's open. In fact I couldn't anyway, as Form is not an editable field.

However, I've found that if I change the on the backend Document just before opening it, even if I don't save it, it opens using the correct form.

For example:

Dim ws as New NoteseUIWorkspace, docOrderItem as NotesDocument, uiDoc as NotesUIDocument
docOrderItem.Form = "Job Sheet"
Set uiDoc = ws.EditDocument(False, docOrderItem, True, , True, True)
Call uiDoc.Print(1)
Call uiDoc.Close(True)

This opens the OrderItem document using the Job Sheet Form, prints it then closes it.

Job done!

sjef_bosman: I'll award you the points, as you pointed me towards qwaletee's solution, which led me to try this way of doing it, so thanks for your help (again).
0
 

Author Comment

by:PaulCutcliffe
ID: 18891188
I've just had another look at qwaletee's solution, & it really is quite elegant - I tend to only think in terms of LotusScript, & as this was never the 'native' way of doing things in Notes, it always seems awkward, almost as if LotusScript has been added to Lotus Notes as a bit of an afterthought - oh yeah, it actually was! :-)

So much of our time as Notes developers seems to be spent trying to get around the limitations of what you can & can't do easily in Notes! And yet we take so many things for granted that it does do really easily.
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 18892025
I agree with you for 100% !

Thanks!
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Saving email w/ attachments using lotus notes 7 318
How can I make DNS resolve different addresses dependant on location? 2 175
Domino Server 2 84
ESXCLI upgrade command 1 139
Lack of Storage capacity is a common problem that exists in every field of life. Here we are taking the case of Lotus Notes Emails, as we all know that we are totally depend on e-communication i.e. Emails. This article is fully dedicated to resolvin…
This article covers general Notes 8.5 troubleshooting information including recreating the Notes\Data folder.
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question