|
|
|
|
|
- Handling a Table programmatically
DocInsertTable (Function) In french: DocInsèreTableau Inserts a table into a Word Processing document ir replaces the specified fragment with a new table.
DocInsertTable(TT_Tableau, 1, 3, 3)
DocInsertTable(TT_Tableau, TT_Tableau.Curseur, 3, 2)
Syntax
Inserting a table into a Word Processing document Hide the details
<Result> = DocInsertTable(<Document> , <Position> [, <Number of columns> [, <Number of rows>]])
<Result>: docFragment variable docFragment variable with the inserted fragment. <Document>: Document or String variable Document to use. This document corresponds to: the name of a Word Processing control. - a variable of type Document.
<Position>: Integer Position where the table will be inserted. This position is expressed in number of characters. <Number of columns>: Optional integer Number of columns in the table. This parameters corresponds to 1 by default. <Number of rows>: Optional integer Number of rows in the table. This parameters corresponds to 1 by default.
Replacing the existing fragment by a new table Hide the details
<Result> = DocInsertTable(<Fragment> [, <Number of columns> [, <Number of rows>]])
<Result>: docFragment variable docFragment variable with the inserted fragment. <Fragment>: docFragment variable Name of the docFragment variable that corresponds to the fragment to handle. The current fragment content will be replaced with the created table. <Number of columns>: Optional integer Number of columns in the table. This parameters corresponds to 1 by default. <Number of rows>: Optional integer Number of rows in the table. This parameters corresponds to 1 by default. Remarks Handling a Table programmatically A table in a Word Processing document can be handled by the WLanguage functions for managing arrays. For example: Example:
DocInsertTable(TT_ExempleTT, 1, 3, 3)
f is docFragment(TT_ExempleTT.Valeur, TT_ExempleTT.Curseur, 0)
let para <- f.Paragraph[1]
IF para.Table = Null THEN
RETURN
END
doc is Document <- TT_ExempleTT.Valeur
nIndice is int = Add(para.Table.Rows)
para.Table.Cells[2,2].Content.Text = "Je suis dans la cellule 2,2"
Delete(para.Table.Rows, 3)
Delete(para.Table.Columns, 3)
Delete(doc.Paragraph, para.ParagraphIndex)
Example for creating a table in a document with the content of a Table control:
MonDoc is Document
cTable is Control <- TABLE_Démo
pCol is Control
FragmentDeb is docFragment(MonDoc,1)
FragmentDeb.Formatting.FontSize = 24
FragmentDeb.Formatting.TextColor = DarkRed
FragmentDeb.Text = "Tableau dans TTX avec " + cTable.Libellé + CR + CR
DocInsertTable(MonDoc, 20, TableCount(cTable, toColumn), cTable.Occurrence + 1)
FOR EACH para OF MonDoc.Paragraph
IF para.Tableau <> Null THEN
FOR nColonne = 1 _TO_ TableCount(cTable, toColumn)
pCol <- TableEnumColumn(cTable, nColonne)
para.Tableau.Cellules[1, nColonne].Contenu.Texte = pCol.Libellé
FOR nLigne = 1 _TO_ cTable.Occurrence
para.Tableau.Cellules[nLigne+1, nColonne].Contenu.Texte = pCol[nLigne]
END
END
BREAK
END
END
TT_Démo = MonDoc
This page is also available for…
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|