NewTable and CurTable objects manage a complete table., while TableColumn and TableRow objects manage other attributes (and supersede optionally some table-level settings), and TableCell object manages cell-level attributes.
Use NewTable object to create a new table with specific attributes, similarly to what is achieved with the InsTableDlg command. Use CurTable object to edit the current table, as you would do it with the EditTableMainDlg command.
Table objects have a number of properties, each one corresponding to a table attribute. Each one of these properties can be set - modifying the corresponding attribute - or queried - returning the value of the corresponding attribute. All the properties have always a value. The values that are assigned to attribute properties are validated: attempts to assign invalid values causes run-time errors, e.g. it is not possible to assign to the NRows property a negative value.
Table objects can be 'attached' (associated) with texts. To perform a number of operations - like editing the attributes specified by a table object - it is actually necessary for the object to be associated with the text. Table object created using GetNewTable or GetCurTable is automatically attached to the current text, whereas object created using CreateObject must be explicitly attached to a text using the AttachObject function.
NewTable object can be obtained from a text being edited using the GetNewTable function, e.g: Dim objNewTable = Text.GetNewTable Remember to end the script with: Text.InsTable (objNewTable) |
CurTable object can be obtained from a text being edited using the GetCurTable function, e.g: dim objCurTable = Text.GetCurTable Remember to end the script with: Text.UpdateTable (objCurTable) |
There's no other way to define the table width except by the >m..< tag placed before the table definition, or by the frame width (either local for text, or from linked page). If there exists a frame, it's width supersedes the >m...< tag value that is ignored. The columns width are set either automatically (by dividing the table width with the number of columns, thus all the columns will initially have the same width), or by the Width property of the TableColumn object, one-by-one column. If you change the width, all the columns with non-fixed width are proportionally resized. |
Which properties you cannot set on the table level?
On the table level, you can't set: •Column widths •Column tags |