RTFReport EXAMPLE
Change in 3.0b2. Reacted to another's errors in execution time
and consequently the algorithm is changed, the check on errors is born
in separate ROUTINE. The gap of sailing of a unit in string on a
vertical is changed. Was -2 earlier.. +2 for all units of measure.
Now is made: for "millimeters" -2.. +2; For "1/1000 inches" -50.. +50;
for "Points" -7.. +7; for "Dialog" -4.. +4. The method of calculation
of sizes of width of columns in HTML to the table is changed. Now is primary
these sizes are translated in percents, that more roughly, but in result
the annoying inaccuracies because of calculations have disappeared.
The description of the extension of templates RTFReport v3.0 beta 2.
Templates are FreeWare.
Assignment: printing of the reports into the file of the
format RTF and/or HTML.
The template does not use neither additional libraries nor
other what or program resources - only environment Clarion and all.
At connection it Extension to standard Report the report generate
into the file (document) RTF or HTML (not on the printer).
Thus not a picture turns out, as it was necessary to expect,
and valuable document (RTF) for further editing or listing,
but already in a text editor of a type Microsoft Word.
Similarly and the file HTML is used on assignment.
Except for the usual text in the document it is possible
to receive the table, the frameworks of the table can be
adjusted both for the table, and for separate (RTF) of cells.
In the table HTML it is possible to adjust association of cells
in a column, and in string the association of cells is
calculated by the template.
At generation in HTML all colour adjustments of units are used,
and also is specific for HTML of adjustment of colours.
Besides, for thin adjustment, the developer can mark a field and
enter into this field units of the language HTML.
Except for main Report in the template the support of templates
UnivReport - CPCS (v5.15) Creative PC Solutions is developed.
But is not realized for CPCS:
EXTENSION:
- CPCSDynaLabels, 'CPCS Dynamic Label Generator'
- CPCSFastDMprint,'Fast DotMatrix Printing support'
CODE:
- StoreBinary,'Store Binary BLOB/MEMO'
- CPCSReportColumns,'CPCS Columnar Report'
- ExitReportLoop,'Exit from the File I/O Loop of a Report'
CONTROL:
- TextBoxPrinter,'Print a TextBox with Overflow'
Copy files RTFRpt.tpl, RTFRptAb.tpl and RTFGpRep.tpw into the directory TEMPLATE. RTFCp.clw copy into the directory LIBSRC. Connect templates by resources Clarion into Temlate Registry. If you used the previous version of templates that re-register templates (unregister and register). For usage of templates in your project it is necessary in Global Extensions, to connect extension RtfReportDef. For creation/designing of the report the standard formatter of the reports "Report" from a main set of templates is used. To the procedure using the template Report, connect Extension: RtfReport.
In Global Extensions adjust CharSet, Code Page, Default Suffix. CharSet and Code Page it is necessary to adjust necessarily, it is necessary that, in the obtained document, the text looked normal& instead of not clear hieroglyphs. Default Suffix - probably it is required to you, that in all used fonts the suffix, for example "Cyr" was added. For example: if for you in properties of a unit or report the "Arial" font is used, in the obtained document will be entered "Arial Cyr". These values are stored(kept) in global variables: RtfFontDefaultCharSet, RtfFontDefaultCodePage, RtfFontDefaultPostPosition accordingly. If necessary it is possible to change these values in execution time of the program.
RTF File Name, HTML File Name - enter here filename or Variable,
for a name of the obtained document.
View Procedure - will guess.
HTML (Bookmark) - Adjustment specific for HTML of the document.
(Global colours and picture for a substrate)
Page (Bookmark) - List of used structures and their adjustments.
For each structure it is possible to specify, how many strings
need to be brought into the table, and also some adjustments of
this table separately for RTF and HTML. The quantity(amount) of
strings is that quantity(amount) of strings, which is
visible during visual formatting of the report. The quantity(amount)
of strings into the table is underlined by a range with N on N.
Printed Lines Per Page - quantity(amount) of strings on page.
If that is equal 0 transition to new page will not be formed under
duress. In execution time this value to be stored(kept) in a local
variable RtfLinesPerPage, and counter of strings in a
variable RtfLinesPerPageCount. At desire it is possible to manipulate
these values. That, for example, what or page to make more shortly
or more longly, or in general to remove forced sharing on pages.
Besides you can use any unit of a string type and in the necessary
moment to enter in it the usual code of transition
on new page - <12> but in this case will not be generated
PageFooter and PageHeader.
Fields (Bookmark) - List of used units and their adjustments.
Some individual adjustments of units:
For RTF the presence and width of each line of cell in the
table is adjusted. For HTML it is possible to specify,
that for a correctness of value in this unit the developer responds.
Such unit will not be handled by the function AnsiToHTML().
Here again it is possible to specify, how many cells in column
should be used by(with) this unit (RowSpan). But this value should
not be more than quantity(amount) of strings getting into the
table since this unit and lower. ** That is, if in structure
5 strings. In the table you have specified with 2 on 4.
The unit is located in 3 strings. That this unit can
borrow(occupy) no more than 2 cells in column. **
Of value less than 2 have no sense (1 and 0 are ignored).
Ignore Left Position - to ignore value of the left position for an extreme left unit in string. For example: the extreme left unit is located on distance 8μμ from left margin of a page. But if "Ignore Left Position" will be equal 10, the string, in the obtained document, will not be shifted from left margin of a page. But if a unit to arrange on distance 11μμ that and in the obtained document string will be shifted on 11μμ from left margin of a page. It concerns and to strings of the formed table. In this connection it is necessary to align the left position for the left units of strings getting in the table.
At generation all user's facilities except for Control of units such as STRING. i.e. graphics primitives, texts is ignored, Check Box and other are not handled. The colour for RTF is ignored.
At generation of the text of the program,
the template uses properties of structures and units accessible
at a stage of generation of the program. And this that that is
visible in Source Report. Most important for generation are the
values AT(N,N,N,N) both in adjustments Report and in adjustments
of structures and units. Here there should not be negative values,
for example, AT(-10,,50,60) speaks that in the visual formatter
of the report any structure, unit, or sectoring of page has
moved down. For units the properties AT(X,Y,,) are invalid,
though X and Y can have zero values, but length and height
should be indicated necessarily. The template uses all these
values as for definition of a sequence of output in the file,
and for definition of a position of a unit in the document and
creation of additional spaces between strings or paragraphs.
If, for example, in string from 5 of units 3 to arrange
hardly that is lower others in the document it will appear
on the following string. Therefore units in one string
align on a bottom.
Are not less important identification of structures and units on
their properties USE. Already at a stage of adjustments you will
feel it if these properties will not be registered.
If the string will not be placed in the table that in
the obtained document (RTF) it will be leveled, as is
indicated in properties of an extreme right
unit (This property of the document). If you wish that in the
table of a column on a vertical were not randomly that align
units on the right edge. At creation of the document
all superfluous blanks where they are excepted were.
At development of the template the efforts are undertaken,
that the strings getting in the table, stuck together
in the uniform table. In link than, you, if necessary, not at
once it will be possible to make so that the table has turned
out torn. And for usual strings the gap is stipulated,
after which exceeding, the additional space between strings
is formed. It that the sizes of a visual unit can very strongly
differ from the obtained character set in the document.
Do not overlook(forget) that the formed document (RTF) can
contain the header. And number of page should be in a page
header - there its place. And Word itself will enumerate
and will enumerate. For this purpose in PageHeader place
String (where or above that has got into colontitul)
in properties of this unit put a tick on "Variable String" and
"Total Type" = "Page No" and enough. To manipulate value of
this unit it is not necessary. In HTML the colontitul is used
for property TITLE of the document. And still, do not
overlook(forget), that in result it to turn out the document.
That is, we sometimes are prevented by a habit,
to use available possibilities.
For example, on one string it is possible to place of
pieces 40 units with the format @s255, in summary,
in the document, some tens strings can turn out.
-----
By me the template is tested on versions Clarion 5 and 5.5 It will be possible to work and on older versions but it is necessary that in LIBSRC\EQUATES.CLW were defined CHARSET:...
If you will detect out errors, write to me or in mailing
lists (ClaList, Clarion) or conference.
If something is impossible to you, it will be a pity
if you only because of it will desert the template - better ask,
do not hesitate, and it is better if through mailing lists.
Quite I admit that some things, obvious to me, can for you
be completely not clear.
The small example of usage RTFReport is enclosed to templates,
look it(him), it(he) unpretentious, but uses almost all
resources of the template.
(for demonstrating printing in HTML the database Products.tps
and set GIF of pictures from an example "Invoice" delivered
with Clarion is borrowed. Copy files *.gif into the directory GIF)
------------
***
Vladimir Degtyarenko
vlad@v-ufal.chel.su (worker)
vhome@v-ufal.chel.su (home)