AddTable Method

[Top]  [Chapter]  [Previous]  [Next]

Create a table and use callback event

Applies to

IWPTextCursor

Declaration

procedure AddTable(const TableName: WideString; ColCount: Integer; RowCount: Integer; Border: WordBool; EventParam: Integer; CreateHeader: WordBool; CreateFooter: WordBool);

Description

This method creates a table and triggers the callback OnCreateNewCell for each created cell if EventParam was passed with a value != 0. So you can add the data and properties is a very efficient way.

 

Since the cursor will be placed inside the first cell, you can, in case it is not possible to use the event, fill text in each new cell by moving the cursor through the table using CPMoveNextCell and CPMoveNextRow. To create text after the table use ExitTable or InputParagraph(2,"") !

Parameters

Name

An optional name for the table. You can use MoveToTable to later locate the table.

ColCount

The count of columns which should be created

RowCount

The count of rows which should be created (not including header/footer rows). You can abort the creation in event OnCreateNewCell by changing the value of the boolen variable AbortAtRowEnd.

Border

Create a broder around cells. You can also set border attributes in event OnCreateNewCell.

EventParam

Parameter passed through to OnCreateNewCell. This event is not called if this parameter is 0.

CreateHeader

If true an extra header row with rownr=-1 will be created. The formatting routine is able to repeat header rows at the start of a page.

CreateFooter

If true an extra footer row with rownr=-2 will be created. The formatting routine is able to repeat footer rows at the start of a page. (This special feature is not supported by MSWord)

 

Tip: You can use the methods ASetCellProp and ASetCellStyle to quickly modify the properties, text and styles of certain cells in an existing table.

Category

Callback Functions

Table Support


[idh_iwptextcursor_addtable.htm]    Copyright © 2007 by WPCubed GmbH