Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • Create a new class: Word report

...

  • Include the following

...

  • entities:
Example reportchild of “Data Data to Word report”reportSingular Entity Type: singular obligatory
Chapter 1: Main Dimensionschild of “Example report” Example reportSingular Entity Type: singular obligatory
Chapter 2: Deck datachild of “Example report” Example reportSingular Entity Type: singular obligatory

Image RemovedImage Added

In Entity “entity Example report, the main document will be created, which includes the separate documents of the Entities “entities Chapter 1: Main Dimensions“and “ 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 during a dialogue write “@SHOW” behind “QEntityData”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 a an RTF document and store it on 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 already created theTutorial_taxonomy_maindimensions.rtf document which you have to place in the right directory.  Download total tutorialImage RemovedDo the same for the documents report.rtf, Tutorial_deck_data.rtf and excel file Example.xls.

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

For the second report chapter Entity we 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 during a dialogue write “@SHOW” behind “QEntityData”Parameter “TableStyle$ contains the word 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 in Figure 84below. See the wiki for a detailed description of TEXTITEM$() function.

 Image Removed

TableStyle$ = TEXTITEM$(1)

Expression Data:

 

Code Block
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:

Code Block
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

 

Image AddedFigure 84: Parameter TableStyle$

Finally on the top level we make the overall report:

...