ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / WLanguage functions / Controls, pages and windows / Word Processing functions
  • Handling a Table through programming
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
Inserts a table in a Document variable.
Example
// Retrieve the document
MyDocument is Document <- WP_Table
// Inserts a 3x3 table at position 1
MyDocument.InsertTable(1, 3, 3)
// Retrieve the document
MyDocument is Document <- WP_Table
// Inserts a table containing 3 columns and 2 rows at cursor position
MyDocument.InsertTable(WP_Table.Cursor, 3, 2)
Syntax

Inserting a table into a Word Processing document Hide the details

<Result> = <Document>.InsertTable(<Position> [, <Number of columns> [, <Number of rows>]])
<Result>: docFragment variable
docFragment variable with the inserted fragment.
<Document>: Document variable
Name of the Document variable to be used.
<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.
Remarks

Handling a Table through programming

A table in a Word Processing document can be handled by the WLanguage functions for managing arrays.
For example:
// Retrieve the document
MyDocument is Document <- WP_ExampleWP
// Inserts a 3x3 table at position 1
MyDocument.InsertTable(1, 3, 3)
// Define a fragment corresponding to the table
f is docFragment(WP_ExampleWP.Value, WP_ExampleWP.Cursor, 0)
let para <- f.Paragraph[1]
IF para.Table = Null THEN
RETURN
END
doc is Document <- WP_ExampleWP.Value
// Adds a row to the table
nIndex is int = Add(para.Table.Rows)
// Input in cell 2,2
para.Table.Cells[2,2].Content.Text = "I am in cell 2,2"
// Deletes row 3
Delete(para.Table.Rows, 3)
// Deletes column 3
Delete(para.Table.Columns, 3)
// Deletes the entire table where the cursor is positioned
Delete(doc.Paragraph, para.ParagraphSubscript)
Component: wd290mdl.dll
Minimum version required
  • Version 24
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 06/21/2023

Send a report | Local help