Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to embed constants
Message
From
22/04/2008 12:20:00
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
 
 
To
22/04/2008 11:53:32
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Miscellaneous
Thread ID:
01312270
Message ID:
01312411
Views:
19
>>>I am building a custom class (vcx) to assist in excel automation. If the various xlConstants are available in excelconstants.h, how would you embed these constants into the class so they would be available to its various methods?
>>
>>Download #9991 does Excel reporting. If you didn't already advance a lot, you may want to take a look at it. ("You must still use the Class | Include file" command for each report subclass.)
>>
>>The class has methods for detail bands, group headers and footers, among others.
>
>Thanks Hilmar. My exercise is educational mostly. I find that if I build it myself I understand it better and can fix it when it doesn't work quite the way I want. I have another excel automation handler written fully in code by someone else. I'm now trying to write my own as a VCX to ease maintenance and usefulness.
>- Don

Sure, that's great. Let me describe my class briefly; you may or may not want to take over some of the ideas.

All text- or Excel-reports are based on my special reporting class.

Some of the key methods of this class, provided for the designer of individual reports, are:
- Print() and PrintLine() - originally defines as wrappers for "??" and "?" commands. Currently I use LLFF, but the behavior is similar. (When designing individual reports, you invoke these methods, but don't code in them; the remainder of the methods are placeholders to write your code.)
- Select() - Here you insert your commands to prepare a data cursor.
- Detail() - For each record in the cursor, this one will be executed once.
- GroupHeader(), GroupFooter() - Invoked every time a group expression changes. The actual group expressions are stored in an array; in GroupHeader() and GroupFooter(), the programmer must use a DO CASE to decide which level is being used. The level is received as a parameter.

After starting the report, .Select() will prepare the data. If this returns 0 or if _tally = 0, the user receives a message to the effect that he may have to change selection criteria (and the report aborts). Otherwise, a method MainLoop() is the main loop (usually not touched by the designer of the final reports) that takes care of traversing the records, invoking .Detail() for each record, checking for changes in group expressions and invoking .GroupHeader() and .GroupFooter(), etc.

HTH,

Hilmar.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform