?
Solved

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

Posted on 2007-04-10
10
Medium Priority
?
1,611 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
 

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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 46

Accepted Solution

by:
Sjef Bosman earned 1000 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

You’ve got a lotus Domino web server, and you have been told that “leverage browser caching” is a must do. This means that we have to tell the browser everywhere in the web to use cache. In other words, we set (and send) an expiration date in the HT…
For beginners of Lotus Notes user this is important to know about the types of files and their location supported by IBM Notes. Mostly users are unaware about how many file types are created and what their usages are. This Article is fully dedicated…
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Suggested Courses

809 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