RepGen - Very simple Report Generator
|
|
class RepGen : public Ctrl
RepGen - Simple Report Generation Class
Supports the construction of simple printed forms. Based on the format QTF.
RepGen looks QTF-pattern and looks for the occurrence of the special variable substitution. In addition, you can loop through the records document, inside the loop is also visible in the substitution of only those variables that are listed inside the loop. (See Tutorial)
void SetTemplate(String tpl)
Set QTF template tpl.to Report.
This must be done at the beginning of this report.
Callback RepGenReportStart
This callback is invoked at the beginning of report processing. Create a function for this purpose and set callback using the operator
rep.RepGenReportStart = callback(ClentCallbackRepStart);
Callback RepGenReportVar
This callback is invoked during the processing static variables of the report (in the middle between the start and finish, but not in the cycle of processing lines in the document).
Create a function for this purpose and follow the callback using the operator
rep.RepGenReportVar = callback(ClentCallbackRepVar);
Callback RepGenReportFinish
This callback is invoked at the end of report processing. Create a function for this purpose and set callback using the operator
rep.RepGenReportFinish = callback(ClentCallbackRepFinish);
Callback RepGenCalculateStart
This callback is invoked at the beginning of the document processing cycle of report.
Here are reset counters before the new cycle.
Create a function for this purpose and follow the callback using the operator
rep.RepGenCalculateStart = callback(ClentCallbackCalcStart);
Callback RepGenCalculateBody
This callback is invoked at the middle of the document processing cycle of report.
Here is the substitution of variables, insert images, the calculation results and counters.
Also, there need to test at the end of a cycle of processing of the document and in this case to call LoopDone();
Create a function for this purpose and follow the callback using the operator
rep.RepGenCalculateBody = callback(ClentCallbackCalcBody);
Callback RepGenCalculateFinish
This callback is invoked at the end of the document processing cycle of report.
Here is the substitution of variables totals and counters.
Create a function for this purpose and follow the callback using the operator
rep.RepGenCalculateFinish = callback(ClentCallbackCalcFinish);
void SubstVar(String s_from,String s_to)
Provides a one-time substitution variable s_from to the expression s_to.
Examples:
rep.SubstVar("##BANKCORRFROM","National &Program Bank"); // Substitution of static text
rep.SubstVar("##TOTAL",Format("%`",TOTAL)); // Substitution of the estimated variable
Note that the substitution occurs one time each cycle.
void PlaceImage (String s_from, Image im_to, Size rep_place = Size(0,0))
Provides a one-time change of variable s_from to qtf-image im_to size rep_place (in the QTF-conditioned units).
Examples:
pictaddr = "/MyApps/RepGenTest/"+pict; //Define real name of Image file
Image im = StreamRaster::LoadFileAny(pictaddr);//Read image to Image var
rep.PlaceImage( "##IMAGE", im, Size(1100,700) );//Substitution ##IMAGE by image im with size 1100x700 units
void LoopDone(bool indicator=true)
Indicates the end of the processing cycle of the document.
Must be called in the client Callback at the time it reaches the end of the document.
void Perform()
Performance report and call the preview window and print the report.
|