Page tree
Skip to end of metadata
Go to start of metadata
  • Create a new class: Word report
  • Include the following entities:
Example reportchild of Data to Word reportSingular obligatory
Chapter 1: Main Dimensionschild of Example reportSingular obligatory
Chapter 2: Deck datachild of Example reportSingular obligatory

In entity Example report, the main document will be created, which includes the separate documents of the entities Chapter 1: Main Dimensions and Chapter 2: Deck data.

  • Create the following parameters in the Knowledge Browser:

Parameter name

Dimension

Determined by

Reference

In Class

Report_document$

[$]

USL: User of System/function

Report document

Word report

Word_file_name$

[$]

USL: User of System/function

Name of Word file

Word report

Document_Tag$

[$]

USL: User of System/function

Document tag

Word report

TableStyle$

[$]

VR: User only

Word table style information

Example:
ParameterBold:=True,
ParameterBackColor:=wdColorBlack,
Font:=Arial 8.5
OutsideBorder:=wdLineStyleSingle wdLineWidth100pt wdColorAutomatic
InsideGrid:=wdLineStyleSingle wdLineWidth050pt wdColorAutomatic
CaseNumbers:=True
TableAlignment:=wdAlignRowCenter

Word report

VBA_Macro$

[$]

USL: User of System/function

VBA Macro that is executed by MS Word

Word report

Mode

[BLN]

VR: User only

Mode for creating a VBA table macro by TELITAB2WORD() function.
0<EQ>Saves as WordMacro_TimeStamp_.bas on working directory and returns file name
1<EQ>Returns the complete VBA macro text

If Mode=1 is selected for manipulation by the knowledge engineer, it should be save using a PUT$() function

Word report

Transposed

[BLN]

VR: User only

Orientation of Word table
0<EQ>Parameters per column 
1<EQ>Parameter per row

Word report

 

  • Include the following parameters in entity Chapter 1: Main Dimensions: Loa, Lpp, Boa, Dm, Volume, Document_Tag$, Report_document$ and Word_file_name.
  • Localize ("instantiate') parameter Volume and remove @MODIFY because you do not want to allow this here.
  • Create the following relations in entity Chapter 1: Main Dimensions:

Loa = ENTITY#(xx).Loa where “xx” is the value of QEntityID of entity Main Dimensions.

Lpp = ENTITY#(xx).Lpp where “xx” is the value of QEntityID of entity Main Dimensions.

Boa = ENTITY#(xx).Boa where “xx” is the value of QEntityID of entity Main Dimensions.

Dm = ENTITY#(xx).Dm where “xx” is the value of QEntityID of entity Main Dimensions.

Volume = ENTITY#(xx).Volume where “xx” is the value of QEntityID of entity Hydrostatics.

Document_Tag$ = "#" + Report_document$ + "#"

Word_file_name$ = "main_dimensions_" + STR$(TIME(0)) + ".doc"

Report_document$ = WINWORD$ Tutorial_taxonomy_maindimensions.rtf(Word_file_name$,0 , Boa, Dm, Loa, Lpp, Volume)

  • To show computed values set attribute @SHOW on QEntityData.

In general, the function WINWORD$ opens and creates an RTF document, saves it as Word document and returns the name of the document. Normally, you have to create an RTF document and store it in the current applications directory (either of the knowledge base, located in Kbs\_<KnowledgeBaseName>\Applic, or the general Applic directory in My Knowledge).

We have created a multi level approach with one main document and several sub-documents. A time stamp is included in the filenames. See the wiki for a detailed description of the functions WINWORD$ and TIME().

For the second report chapter entity, do about the same as for the first chapter:

  • Include the following parameters in entity Chapter 2: Deck data: Deck_data#, Document_Tag$, Report_document$, Word_file_name, Mode, TableStyle$, Transposed and VBA_Macro$.
  • Create the following relations in entity Chapter 2: Deck data:

Deck_data# = ENTITY#(xx).Deck_data# where “xx” is the value of QEntityID of entity Decks.

Mode = 0 (0<EQ>Saves as WordMacro_TimeStamp_.bas on working directory and returns file name)

Transposed = 0 (0<EQ>Parameters per column)

Document_Tag$ = "#" + Report_document$ + "#"

Word_file_name$ = "deck_data_" + STR$(TIME(0)) + ".doc"

Report_document$ = WINWORD$ Tutorial_deck_data.rtf(Word_file_name$, 0, VBA_Macro$)

VBA_Macro$ =  TELITAB2WORD$(Deck_data#, 1, TableStyle$, Transposed, Mode) 

  • To show computed values set attribute @SHOW on QEntityData.

The TELITAB2WORD$ function returns a MS Word macro to create a table in Word based on a given Telitab set, in this case Telitab “Deck_data#”. See the wiki for a detailed description of TELITAB2WORD$ function.

Parameter TableStyle$ contains the Word table style information.

  • Create the relation as shown below. See the wiki for a detailed description of TEXTITEM$() function.

TableStyle$ = TEXTITEM$(1)

Expression Data:

TEXTITEM1=

|Formatted:=True

ParameterBold:=True,

ParameterBackColor:=wdColorGray25,

Font:=Arial 8.5

OutsideBorder:=wdLineStyleSingle wdLineWidth100pt wdColorAutomatic

InsideGrid:=wdLineStyleSingle wdLineWidth050pt wdColorAutomatic

CaseNumbers:=True

TableAlignment:=wdAlignRowLeft|

 Expression Reference:

Word table style information

 

Example:

ParameterBold:=True,

ParameterBackColor:=wdColorBlack,

Font:=Arial 8.5

OutsideBorder:=wdLineStyleSingle wdLineWidth100pt wdColorAutomatic

InsideGrid:=wdLineStyleSingle wdLineWidth050pt wdColorAutomatic

CaseNumbers:=True

TableAlignment:=wdAlignRowCenter

 

Finally on the top level we make the overall report:

  • Include the following parameters in entity Example report: Report_document$ and Word_file_name$.

TODO: ----

You have to modify the total report report.rtf in order to let the overall summary report do its work.

In the template of the total report report.rtf we added #ENTITY#(xx).Document_Tag$#. This is the reference to the parameters Document_Tag$# in the relevant Entities. You have to check whether the QEntityID of the two references in the template are correct. If you modify the RTF document, please remember to check it in Quaestor using the Tools>RTF Template Check... option.

----

  • Finally, create the following relations in entity Example report:

Word_file_name$ = "Report_" + STR$(TIME(0)) + ".doc"

Report_document$ = WINWORD$ Report.rtf(Word_file_name$, 0 , ENTITY#(xx).Document_Tag$, ENTITY#(xxx).Document_Tag$) where “xx” is the value of QEntityID of entity Chapter 1: Main Dimensions and “xxx” of entity Chapter 2: Deck data.

  • To show computed values set attribute @SHOW on QEntityData.

Back to content | << Previous | Next >>

  • No labels