TELITAB2WORD$ returns a MS Word macro to create a table in Word based on a given TeLiTab set
TELITAB2WORD$(Telitab$, ParameterStyle(=-1,0,1,2,3,4), TableStyle$, Transposed(=0,1), [Mode=0,1]
Arguments
Please note that we have limited ourselves in the number of possible styles as to be defined in TableStyle$ parameter. However, the definition of the styles in TableStyle$ does have direct resemblance with the VBA code of Word. You can use the macro record function in Word and investigate the generated VBA code to get inspiration for the TableStyle$ content. In the examples tested combination are presented.
The TELITAB2WORD$() function behaves very much like the TELITAB2HTML$() function is this sense that, depending on the TeLiTab, it will generate the appropriate list and table as separate tables.
Assuming you have the following TeLiTab connected to the parameter MainDimensions#:
3" BOT" 4 "CB" .65 "LOB" 6 4 "B" "LPP" "T" "VOL" "1" 8.33 50.0 2.08 564 "2" 9.17 55.0 2.29 751 "3" 10.00 60.0 2.50 975 "4" 10.83 65.0 2.71 1240 "5" 11.67 70.0 2.92 1548 |
To generate the Word document containing this dataset as proper Word table, we use the following relation (see also WINWORD$() ):
MyReport$ = WINWORD$ Appendix_element.rtf("Report_" + STR$(TIME(0)) + "_Set_"+STR$(ORCA(1)) + ".doc", 0, VBA_Macro$, ItemName) |
As you see, in this relation VBA_Marco$ and ItemName are requested (and they are put in the Word template, see the example knowledge base below).
The parameter ItemName is just a parameter to give a name in the generated document. VBA_Marco$ contains the actual TELITAB2WORD$ function to generate the VBA code required as Word macro in the document to generate the table. VBA_Marco$ could have the following relation (in this case we have made the relation fully parametric but you can also provide the above described values right away):
VBA_Macro$ = TELITAB2WORD$(MainDimensions#, ParameterStyle, TableStyle$, Transposed, Mode) |
With
MainDimensions# |
, the above dataset;
ParameterStyle |
, user input for the ParameterStyle, for instance a select box using an <EQ> construction in the reference of the parameter and the @EQEXPLAIN attribute in the data slot of the parameter;
TableStyle$ |
, contains either a text document with descriptions for the Table style (such as different example presented below) or determined by an expression to generated this document for TableStyle$ using separate parameters
FormattedBln$, ParameterBoldBln$, FontStyle$, OutsideBorder$, InsideGrid$, CaseNumbersBln$, andTableAlignment$ |
.
The relation could be (see also the example knowledge base):
TableStyle$ = TEMPLATE$(TEXTITEM$(1),0, FormattedBln$,ParameterBoldBln$,FontStyle$,OutsideBorder$,InsideGrid$,CaseNumbersBln$,TableAlignment$) |
with in the dataset:
TEXTITEM1= |Formatted:=~FormattedBln$ ParameterBold:=~ParameterBoldBln$ Font:=~FontStyle$ OutsideBorder:=~OutsideBorder$ InsideGrid:=~InsideGrid$ CaseNumbers:=~CaseNumbersBln$ TableAlignment:=~TableAlignment$| |
Examples of
TableStyle$ |
Centred, unformatted: Formatted:=False Centred, formatted, with black parameters: Formatted:=True Left aligned, formatted, with normal parameters: Formatted:=True Left aligned, formatted, with normal parameters, transposed table: Formatted:=True Centred, formatted, with black parameters, table without case numbers: Formatted:=True Centred, formatted, with black parameters, table without case numbers, transposed: Formatted:=True Left aligned, formatted, with normal parameters, larger courier font: Formatted:=True Left aligned, formatted, with normal parameters, no case numbers, larger courier font: Formatted:=True Left aligned, formatted, with normal parameters with no outside grid lines: Formatted:=True Left aligned, formatted, with normal parameters with no inside grid lines: Formatted:=True Left aligned, formatted, with normal parameters with no inside grid lines, no case numbers: Formatted:=True |
Transposed |
, user input to present the table transposed
Mode |
, user input for the mode of the function
The result of
MyReport$ |
Download
An example knowledgebase of this function can be downloaded here.
Description
By using MyReport$ as TopGoal, the knowledge base generated the Word table based on:
Quick links: Function overview | Attribute overview | Constants overview | Dimensions overview