![]() |
|
Published 1999-02-01 Printer-friendly version
There are products you like. There are products you review. Often there are products you like to review. But rarely are there products youd give your eyeteeth to review. This is one. For several years I have been interested in interfacing Clarion apps with other products and with a word processor in particular (you may be aware of my review of RichX some time ago).
The name says it all: Arco Word Reporter (AWR). The product allows you to use Microsoft Word as the recipient of a Clarion report. Another way of thinking about this is that, after creating the report, it appears as a document in MS Word. This means that you have all of the formatting capabilities of MS Word for your Clarion reports, and it also means that you can do final editing to a report before final print. The possibility of this excited me greatly.
Then I viewed the documentation - and was scared to death. This is not to say that the product is hard to implement. CC+CC, the makers of Arco Word Reporter, have apparently decided that you may not fully understand what the product is all about, and so launch into an explanation of the product (with diagram) followed by almost four and a half pages of Class Methods and Properties followed by almost two pages of very detailed installation instructions. Whew!
Installing Arco Word Reporter
I began by following the installation instructions. You must follow them meticulously. These instructions require that you copy files to a variety of directories and then register the OCX as well as the templates. This required a few careful minutes. While installing, I had a problem finding one of the files I needed to copy so I emailed arco@cccc.ch and they responded quite promptly with an answer. By the way, their website www.arcosoftware.com has a "frequently asked questions" area, and youll note my problem has made its way onto the list.
Tutorials (yes, there are more than one)
If you put the effort into understanding this product I think you will be very happy with it. CC+CC understands this and have created several tutorials to help you understand their product.
First, an aside. My mom is eighty-two. She has never used a computer and, one day when I was at her home, she asked me about e-mail. I tried to explain the idea (yes, this is relevant). She didnt get it and was clearly more confused. I tried again. No luck. I tried a third time and did no better. Finally, I said that the next time she came over to our house I would show her e-mail, and I did. At the end of the demonstration she said, "Thats it? Whats the big deal?" She still didnt know what happened behind the scenes but she knew about e-mail. I feel the same way about this product.
As I told you, the documentation intimidated me (as did the tutorials), but after doing them I felt a lot better. I felt I understood how the product worked and what I needed to do to use it in my own applications. There are three tutorial applications: tutor.app you can simply compile and run to see what the product can do; atutor.app is the tutorial app that you will use with the tutorial in the documentation; and btutor.app which is a successfully completed version of atutor (I couldnt have done without it).
This said, I did step through the tutorial, which required that I write a couple pages of source code. My first reaction was to be annoyed at all the coding. But as I did it I found I was gaining insight into how the product works. Heres a rule: Do the tutorials!
After completing the tutorial I compiled it and scratched my head looking at the errors. I fixed a series of errors that were mine (periods instead of commas, and some typos) and removed two lines of code that were done correctly but that produced errors. Now the app compiled with no errors but, when run, failed to work correctly. At this point I fired a question off to CC+CC asking about the two lines I had removed that I couldnt get to compile correctly.
Once that was done, I was about to stop for the day when I happened to note the following sentences: "If something went wrong we also provided the finished tutorial. Checkout bTutor.app!" So I did and found that I had some code in the wrong embed. The documentation really wasnt clear. Honest, it wasnt me. Once I made the changes the application worked flawlessly.
You might think that I was now ready to do my own application. Wrong! The way AWR works is to send stuff to Microsoft WordÒ that is then formatted based on an existing RTF file and a DOT (Document Template) file. It seemed like a good idea to take a look at both. The DOT file was very simple. Here it is:
Well look at this in more depth later. But first lets take a look at the RTF file.
Amazing! This is scary! Well, perhaps not that scary but it illustrates a point. You must understand this stuff also to effectively use the product, and well look at it in more depth.
I decided that I had better understand this stuff before I attempted to use AWR in my own application. So what follows is my understanding of how the products (AWR and Word) work together. Here is an explanation (slightly modified) from the AWR documentation.
Essentially, your program invokes the AWR CLASS, which then reads the MS Word template looking for bookmarks. AWR loops through the bookmarks and, for each found bookmark, asks your program to replace them with values from your programs data files and pass the replacements back to AWR. At this point, it is either ready to process the next document (as in a multi-invoice report) or is finished making MS Word visible and finishing the communication. Note that MS Word uses the RTF file as the basis for what it does with the data from AWR and your application. Here is a sample result.
Pretty impressive! As I said, it seemed (and it was) important to understand how this all worked together so I began by examining the AWR documentations discussion of the document template and to examine the template file. I checked out the following: Pasadena, @invoicedate@. The documentation points out that:
As you can see, any formatting Word allows can be used!
So now, how does this relate to whats going on in the application? Well here goes.
As with most Clarion tools, the first step is to add a global extension to your app. Then you must also add a bunch of global variables (16 by my count). Then the main procedure gets an embed to read from an ini file. Beyond this, everything sort of depends on what youre planning to do. In the case of the atutor.app, it shows a browse with a list of orders or invoices, and you can print (send to MS Word) any invoice. On the browse is standard logic to make sure that the current record is in memory and ready. The browse has a print button that calls a PrintOrder procedure where all the critical logic is contained. This is what well look at here because its what helped me to understand what was going on.
This procedure is a window with a lot of logic going on. A procedure extension template is added and filled out according to instructions in the manual. Then source code (remember all the source code I had to type?) is inserted into various embeds. Theres code to read the order; read in a record from another file (the print layout record) that defines what template (DOT) and what Style (RTF) files are to be used. Then finally there is one more procedure (containing the most source code) and here it is (mildly edited for formatting):
MyWord.ReplaceBM Function(String InStr)
Code
!// This method is called from MyWord.MakeDoc(). The Inputstring (Instr) contains
!// a bookmark that AWR has found. You decide what to do with that.
CASE Upper(InStr) !Use Upper so your user can use mixed case
OF 'INVOICEDATE' !Single field
MyWord.WriteField(Format(ORD:Oda,@d6))
OF 'INVOICEADDRESS' !Another single field
MyWord.WriteField(Ord:Adr)
OF 'ORDERTYPE' !Another single field
MyWord.WriteField(Ord:oty)
OF 'INVOICENUMBER' !Another single field
MyWord.WriteField(Ord:Nr)
OF 'SUBJECT' !Another single field
MyWord.WriteField(ORD:Ote)
OF 'ARTICLELIST'
!First print a Header - Stylenumber 13
If MyWord.GetStyle(13) !found the style
!Define the Bookmarks and values to replace
!The first cell is the one you definded in the style file
!the 2nd one is the value that replace the bookmark (cell 1) in the style file
!Note that you can define everything CW allows in the 2nd cell
!ie: format, clip etc. (see below..)
MyWord.WriteCell('@pos','Position')
MyWord.WriteCell('@txt','Items')
MyWord.WriteCell('@qty','Quantity')
MyWord.WriteCell('@prs','Price')
MyWord.WriteCell('@tot','Total')
MyWord.WriteStyle() !Send that to word
End
!Now we need an empty line for spacing
IF myWord.GetStyle(01) then MyWord.WriteStyle() end
!Go through the items database and print the single records
Ite:Ord = Ord:Nr
Clear(Ite:Nr,-1)
Set(Ite:Key_Ord_Nr,Ite:Key_Ord_Nr)
Loop
next(Items)
If ErrorCode() or Ite:Ord not = Ord:Nr then Break end
!Depending on the status of the item we choose a style
Case Clip(Ite:Sta)
of 'on stock'
IF not myWord.GetStyle(11) then cycle end
of 'delayed'
IF not myWord.GetStyle(15) then cycle end
End
Case Clip(Ite:Sta)
of 'on stock'
myWord.WriteCell('@pos',Ite:Nr)
of 'delayed'
myWord.WriteCell('@pos',ITE:Nr &' del.')
End
myWord.WriteCell('@txt',Clip(ITE:Ite))
myWord.WriteCell('@qty',Format(ITE:Qua,@n-_10.2))
myWord.WriteCell('@prs',Format(ITE:Pri,@n-_10.2))
myWord.WriteCell('@tot',Format(ITE:Tot,@n-_10.2))
myWord.WriteStyle() !Send that to Word
Loc_Sub += ITE:Tot !Count for subtotal
END
!Now we need another empty line for spacing
IF myWord.GetStyle(01) then MyWord.WriteStyle() end
!Print subtotal - Stylenumber 32
IF myWord.GetStyle(32)
myWord.WriteCell('@txt','Subtotal')
myWord.WriteCell('@tot',Format(Loc_Sub,@n-_10.2))
myWord.WriteStyle() !Send that to Word
End
!Print tax - Stylenumber 14
Loc_Tax = Loc_Sub * 9.5 / 100
IF myWord.GetStyle(14)
myWord.WriteCell('@txt','Tax 9.5%')
myWord.WriteCell('@tot',Format(Loc_Tax,@n-_10.2))
myWord.WriteStyle() !Send that to Word
End
!Now we need another empty line for spacing
IF myWord.GetStyle(01) then MyWord.WriteStyle() end
!Print Grandtotal - Stylenumber 33
Loc_Tot = Loc_Sub + Loc_Tax
IF myWord.GetStyle(33)
myWord.WriteCell('@txt','Total')
myWord.WriteCell('@tot',Format(Loc_Tot,@n-_10.2))
myWord.WriteStyle() !Send that to Word
End
Else
Return(False) !No Bookmark to replace
End
Return(True) !Bookmark replaced
Youll notice at the beginning of the code where items from the DOT are read in and replaced. Then youll note the style information is read in and header information is replaced, as well as the individual detail lines with final totals summing up.
Ive edited this code very slightly but only to change word wrapping so that youll get the idea of whats involved.
Finally, I was ready to produce my own application. It would not be fair to you for me to now spend pages detailing my own application. Suffice it to say that I successfully added AWR to my app and it works!
During my initial attempt at installing the product I ran into a minor problem as mentioned earlier. An e-mailed message brought a quick response (within 24hours) that was right on the money. When I had my problem with the demo app I sent of a message, but before the CC+CC staff could respond I had figured out what the problem was by examining the additional tutorial application. However, I chose to wait for their response to see how well they diagnosed the problem. The problem was that I has inserted code into the wrong embed. They responded again within 24 hours asking some questions to which I responded. Their questions made it clear to me that they knew their product well and their final response not only explained what was wrong but also suggested an alternative approach. Nice job.
For such a product I initially thought the documentation (23-page DOC file) was a little thin. However, as I used it I found it to be quite good. The approach of initially telling me more than I thought I wanted to know turned out to be the proper approach. The document is highly readable, which may surprise some considering the writers native language, I suppose, is Schweitzer-Deutsch.
Let me be clear. The product works! That said, I believe I given you the feeling that it is a fairly complicated product to use right from the moment of installation. I would like to see the installation process made simpler.
Next, since there is a fairly long list of global variables to be added, it would be nice if adding the global extension template would also cause the variables to be added. Finally, the tutorial could be beefed up a little. Particularly the explanation of which embed to use. It would have eliminated a support question. Overall, a very nice product if a little bit intimidating.
Sometimes its hard to do these ratings. This is one of those times. On the one hand, the product works, and works well. On the other, it requires a fair amount of coding and the setting up of the DOT and RTF files (The RTF file setup is not insignificant). So here goes.
| Category |
Product Score |
| Ability to do the task |
Very Good |
| Ease of use |
Good |
| Ease of Installation |
Very Good |
| Documentation |
Very Good |
| Technical Support |
Excellent |
| Modifies Shipping Templates |
No |
| Black-Box DLLs/LIBs |
Yes |
The ARCO Word Reporter lists for US $295, and is available directly from CC+CC as well as from Topspeed (1-800-354-5444). AWR is compatible with C4 and C5, using either legacy (Clarion) or ABC template chains.
More information, frequently asked questions and a demo can be found at: http://www.arcosoftware.com/devtools/devtools.html (Note: This is the only English language section of their web site.)
Vendor Comments from ARCO/CC+CC
First of all we are very happy about the test results and would like to say thanks to Drew for his great work and the opportunity to be tested in ClarionOnline.
We know its not that easy to work with our Tool; you have to spend a couple of hours to really understand how everything goes together but the results are sure worth the work.
| Vendor comments from CC+CC |
A couple of things we like to add/clarify
We always improve the usability and flexibility of AWR and its documentation so watch out and visit our homepage from time to time (we also announce that in TopSpeeds 3rd party newsgroup). Ok, thanks for reading and now back to reporting! Reto Camenzind & Hanspeter Stutz CC+CC - Switzerland |
Copyright © 1999-2008 by CoveComm Inc. All Rights Reserved. Reproduction in any form without the express written consent of CoveComm Inc., except as described in the subscription agreement, is prohibited.
Clarion Magazine ISSN 1718-9942
One year: $184
(includes all back issues since '99)
Renewals from $134
Two years: $274
Renewals from $224