|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--VKRep.TReportAbstract | +--VKRep.TReportVertical | +--VKRep.TWordReport
Title: Reporter to RTF, HTML, TXT.
Description: Main class for all vertical text based reports (TXT, RTF, HTML).
First of all you should make blank for you report with format what you want. Class TWordReport allowed to do reports in text based formats such as TXT, RTF, HTML. So if you want to get TXT file with you data you should make TXT format blank, if you want to get RTF file you should make RTF blank, and HTML blank if you want HTML.
The blank in any formats may consists of report sections. There are 11 standard sections and 2 special sections. In addition you can define your own report sections.
11 standard sections:
2 special sections:
All sections have a name and a number. All standard sections have a predefined name and numbers from 0 to 12. When you define your own section you give name this section and when you register this section in reporter ( method int prepareSection(String SectionName) ) you supplied number of section (returned from prepareSection). You can invoke prepareSection only in doSectionPrepare or in prepareSection event.
The section definition looks differ in differ formats. For example in RTF format REPORT_HEADER section definition looks like:
#BEGIN SECTION 'REPORT HEADER' ... #END SECTION 'REPORT HEADER'
The same in HTML format:
<!-- { #BEGIN SECTION \lquote REPORT HEADER\rquote } --> ... <!-- { #END SECTION \lquote REPORT HEADER\rquote } -->
And for TXT format:
{ #BEGIN SECTION \lquote REPORT HEADER\rquote } ... { #END SECTION \lquote REPORT HEADER\rquote }
Two special sections (FILE_HEADER and FILE_FOOTER) is needed for define work area in blank where dispose all other sections.
The FILE_HEADER section is part of blank from begining of the blank file to the definition:
#BEGIN VKREPORT
And the FILE_FOOTER section is part of blank from
#END VKREPORTto the end of blank file.
In that way, if we are view (for example) RTF blank in low level, in text editor as a text file we can see the follow:
begin of blank file | | {\rtf1\ ... |file | ... |header | {... #BEGIN VKREPORT ...} | | ... | | | {... #BEGIN SECTION \lquote REPORT HEADER\rquote ... } |report | ... |header | {... #END SECTION \lquote REPORT HEADER\rquote ... } | | | {... #BEGIN SECTION \lquote BODY\rquote ... } blank |body | ... file | | {... #END SECTION \lquote BODY\rquote ... } | | | {... #BEGIN SECTION \lquote REPORT FOOTER\rquote ... } |report | ... |footer | {... #END SECTION \lquote REPORT FOOTER\rquote ... } | | ... | |file | {... #END VKREPORT ... } |footer | } end of blank file
Properly speaking, all reporter to do is only copy sections from input blank to the output report according the following schema:
copy FILE_HEADER (always) copy REPORT_HEADER (try always) doMoveTop //move your data source to the top loop ( not end of your data source ) copy GROUP_HEADER copy SUBGROUP_HEADER copy SUBSUBGROUP_HEADER copy SUPERSUBGROUP_HEADER copy BODY (try always) copy SUPERSUBGROUP_FOOTER copy SUBSUBGROUP_FOOTER copy SUBGROUP_FOOTER copy GROUP_FOOTER doMoveNext //move your data source to the next row end loop copy REPORT_FOOTER (try always) copy FILE_FOOTER (always)
Process of copy any section is accompany following events:
doSectionBegin //notify event doSectionCheck //qury event to ask copy section or not if SectionCheck == true then copy content of section with query data from your data source doSectionComplete //notify event end if doSectionEnd //notify event
As you see, you can define in program youself when to copy section exactly (group sections should copy only for definite condition).
The data for report is supplied by mark. There are two types of marks: mark by name and mark by number.
Mark by name looks like:
... ~field_name1~ ~field_name2~ .... ...
Mark by number looks like:
... @0001 @0002 .... ...
When reporter copy section and determinate data request mark (by name or by numbar) it fire event for delivery data. Your programm should handle this event and return data corresponding to mark.
The navigation within data source realize throw two events: onMoveTop and onMoveNext.
Create blank process include 2 steps in general. First - edit blank in high level tools, such as WordPard, WinWord, FronPage and so on.
The second step is needed for correct defects in blank after high level tools and it happens in low level tools like a simple text editor.
Open WinWord. Define work area to type #BEGIN VKREPORT at begin and #END VKREPORT at end.
I usually to set of blue color for #BEGIN VKREPORT and #END VKREPORT.
Between #BEGIN VKREPORT and #END VKREPORT define any report sections with data request mark within section. Any section start with #BEGIN SECTION 'SECTION NAME' and end of #END SECTION 'SECTION NAME'. Tag #BEGIN SECTION I usually set to green color and tag #END SECTION set to gray color. The color set is needed for correct compound VK Report tag within a RTF tag.
You can apply any formating text, paragraph. Use tables, lists and any ather features RTF format - these all available for you reports.
This step is needed because WinWord may mix VK Report control tags within RTF control tags and VK Reports can not find these. Perceive this step like instraction:
{\v\cf10\lang1033\langfe1033\langnp1033 #BEGIN SECTION \lquote REPORT {\lang1033 HEADER}\rquote \par }the VK Reports not find key string - '#BEGIN SECTION \lquote REPORT HEADER}\rquote'. It's bad. You should delete unnecessary symbols by hands. After modifications the RTF tag must looks like:
{\v\cf10\lang1033\langfe1033\langnp1033 #BEGIN SECTION \lquote REPORT HEADER\rquote \par }
< begin of your HTML report blank > ... < !-- { #BEGIN VKREPORT } -- > < !-- { #BEGIN SECTION \lquote REPORT HEADER\rquote } -- > ... @0001 ... @0002 ... < !-- { #END SECTION \lquote REPORT HEADER\rquote } -- > ... < other sections > ... < !-- { #BEGIN SECTION \lquote BODY\rquote } -- > ... @0001 ... @0002 ... < !-- { #END SECTION \lquote BODY\rquote } -- > ... < other sections > ... < !-- { #BEGIN SECTION \lquote REPORT FOOTER\rquote } -- > ... @0001 ... @0002 ... < !-- { #END SECTION \lquote REPORT FOOTER\rquote } -- > < !-- { #END VKREPORT } -- > ... < end of your HTML report blank >As you see VK Reports tags design as HTML remarks with RTF tags inside for compatibility between these formats.
< begin of your TXT report blank > ... { #BEGIN VKREPORT } { #BEGIN SECTION \lquote REPORT HEADER\rquote } ... @0001 ... @0002 ... { #END SECTION \lquote REPORT HEADER\rquote } ... < other sections > ... { #BEGIN SECTION \lquote BODY\rquote } ... @0001 ... @0002 ... { #END SECTION \lquote BODY\rquote } ... < other sections > ... { #BEGIN SECTION \lquote REPORT FOOTER\rquote } ... @0001 ... @0002 ... { #END SECTION \lquote REPORT FOOTER\rquote } { #END VKREPORT } ... < end of your HTML report blank >
Copyright: Copyright (c) 2003
Company:
Nested Class Summary |
Nested classes inherited from class VKRep.TReportAbstract |
TReportAbstract.BOutStream, TReportAbstract.TBiffRec, TReportAbstract.TBiffRecHeader, TReportAbstract.TSection |
Field Summary |
Constructor Summary | |
TWordReport()
|
Method Summary | |
private int |
findTag(java.lang.String tag)
|
protected void |
outSectionInternal(int SectionNum,
boolean defaultOut)
Abstract method for override in inheritance classes for output report section. |
protected boolean |
prepareFileFooter()
Abstract method for override in inheritance classes for parse file footer section. |
protected boolean |
prepareFileHeader()
Abstract method for override in inheritance classes for parse file header section. |
protected int |
prepareSectionInternal(java.lang.String SectionName,
int SectionNum)
Abstract method for override in inheritance classes for parse report section. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public TWordReport()
Method Detail |
protected void outSectionInternal(int SectionNum, boolean defaultOut)
TReportAbstract
outSectionInternal
in class TReportAbstract
SectionNum
- section number for out.defaultOut
- default logic value means outed it by
default or not.protected boolean prepareFileHeader()
TReportAbstract
prepareFileHeader
in class TReportAbstract
protected boolean prepareFileFooter()
TReportAbstract
prepareFileFooter
in class TReportAbstract
protected int prepareSectionInternal(java.lang.String SectionName, int SectionNum)
TReportAbstract
prepareSectionInternal
in class TReportAbstract
SectionName
- section name for prepare.SectionNum
- section number for prepare.
private int findTag(java.lang.String tag)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |