Solved

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

Posted on 2007-04-10
10
1,315 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
Comment Utility
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
Comment Utility
0
 

Author Comment

by:PaulCutcliffe
Comment Utility
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
 
LVL 46

Accepted Solution

by:
Sjef Bosman earned 250 total points
Comment Utility
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
Comment Utility
Actually, qwaletee's solution was quite useful - I may see if I can incorporate some of this ideas.

Watch this space...
0
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 
LVL 46

Expert Comment

by:Sjef Bosman
Comment Utility
I'm all eyes!!!
0
 

Author Comment

by:PaulCutcliffe
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
I agree with you for 100% !

Thanks!
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Suggested Solutions

Notes Document Link used by IBM Notes is a link file which aids in the sharing of links to documents in email and webpages. The posts describe the importance and steps to create a Lotus Notes NDL file in brief.
This article covers general Notes 8.5 troubleshooting information including recreating the Notes\Data folder.
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

743 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now