Working with InDesign® tables.
You will find a general example for the use of table here.
Working with InDesign® tables.
For this module, the import
#include "internal/table.h"
#include "internal/text.h"
must be given.
static Table table::alloc(Table org = 0)
Create a new object of the table type. The instruction does not yet point to a existing table of an Indesign® document. The object must be deleted again using table::release.
| Name | Type | Default | Description |
| Return | Table | Empty table object. | |
| org | Table | 0 | Original 0 : create a new empty reference otherwise : copy original. Only the reference is copied, not the table itself. |
static Table table::assign(Table dest, Table src)
Cpoy one table reference to another. Only the reference is copied, not the table itself.
| Name | Type | Default | Description |
| Return | Table | dest or 0 in case of some erros | |
| dest | Table | - | destination pointer |
| src | Table | - | original |
static int table::release(Table t)
Delete a table object from the memory. If the object points to an existing document table, this reference remains untouched.
| Name | Type | Default | Description |
| Return | int | 0 or ErrorCode | |
| t | Table | - | Valid table object. The object need not point to an existing document table. |
static int table::defined(Table t)
Is the table reference defined?
| Name | Type | Default | Description |
| Return | int | 0 Variable not defined 1 The reference is defined and points to a valid table |
|
| t | Table | - | Table reference to be checked |
static int table::is_valid(Table t)
Is the table reference defined? The function is identcally to defined.
| Name | Type | Default | Description |
| Return | int | 0 Variable not defined 1 The reference is defined and points to a valid table |
|
| t | Table | - | Table reference to be checked |
static int table::create(
Table T,
ItemRef frameRef,
int rows,
int cols,
int insertion = 0,
int removes = -1,
float height = 20.0,
float width = 30.0,
int header = 0,
int footer = 0,
int placeholderRelative = 1,
char* tableStyle = 0)
| Name | Type | Default | Description |
| Return | int | 0 or ErrorCode | |
| T | Table | - | Table object created with table::alloc |
| frameRef | ItemRef | - | From Version 1.1.6 Frame to create the table in. 0 : Current script frame otherwise : Valid reference of a text frame Ignored by Illustrator. |
| rows | int | - | Number of rows to create |
| cols | int | - | Number of columns to create |
| insertion | int | 0 | Insert position in the text
Ignored by Illustrator. |
| removes | int | 0 | How many characters are to be deleted before the insert? kEnd : Until the end of the text Ignored by Illustrator. |
| height | float | 20.0 | Height of the table cells in points. Until v4.3 R34952
|
| width | float | 30.0 | Width of the table columns in points 0.0 : Set columns widths so that the table becomes as wide as the frame. Corresponds to manually inserting a table in InDesign®. |
| header | int | 0 | Number of header rows |
| footer | int | 0 | Number of footer rows |
| placeholderRelative | int | 1 | Unused |
| tableStyle | char* or String | 0 | Table style. If the entry is empty or missing, the style base table style is used. |
Replace the complete text of the current placeholder with a 2x4 table. In scripts not called by placeholders (panel scripts, layout rules, ...) the complete content of the current script frame is replaced.
int main ()
{
int T = table::alloc ();
if (!T) return 0;
if (table::create (T, 0, 2, 4) != 0)
{
showerror ("The table could not be created");
}
table::release (T);
return 0;
}
Replace the current placeholder text by "AAA(2x2-Table)XXX.". In scripts not called by placeholders (panel scripts, layout rules, ...) the complete content of the current script frame is replaced.
#include "internal/types.h" #include "internal/text.h"
int main () { int T = table::alloc ();
if (!T) return 0;
textmodel::replace ("AAAXXX", 0, kEnd);
table::create (T, gFrame, 2, 2, 3, 0, 20.0, 20.0); table::release (T);
return 0; }
The second example checks the current text selection of the document. If table text is selected, the current cells of the table will be replaced by a sub-table.
#include "internal/types.h" #include "internal/text.h"
int main () { Table t = table::alloc(); Table u = table::alloc(); ItemRef f = item::alloc(); int start, len, col, row;
if ( textmodel::selection (&start,&len,f,0,t,&col,&row)==0 && table::defined (t) && table::get_textpos (t,col,row,&start,&len) == 0) { table::create (u,f,2,2,start,len,20.,20,1,1,0); } else beep ();
table::release (t); table::release (u); item::release (frame);
return 0; }
static int table::remove(ItemRef frameRef, int index)
Delete a table and its complete contents.
| Name | Type | Default | Description |
| Return | int | 0 or ErrorCode | |
| ⇨ Indexed table | |||
| frameRef | ItemRef | - | From Version 1.1.6 Frame to remove the table from. 0 : current script frame |
| index | int | - | 0-based table index according to the text positions of the tables |
| ⇨ Referenced table | |||
| tableRef | ItemRef | - | valid table reference |
static int table::get(
Table T,
ItemRef frameRef,
int nth,
int textStart = -1,
int textLen = -1)
n-th table of the text. Sort oder is the text position of the table.
| Name | Type | Default | Description |
| Return | int | 0 or ErrorCode | |
| T | Table | - | table object created with table::alloc |
| frameRef | ItemRef | - | From Version 1.1.6 Frames the text of which the tables are to be created in. 0 : Current script frame otherwise : Valid reference of a text frame |
| nth | int | - | 0-based index of table according to the text positions |
| textStart | int | -1 | Search the i-th tables starting from a defined text position. The index index is
0-based. -1 : Search the entire text kSelection : Search in the current selection |
| textLen | int | -1 | Search the i-th table only in a part of the text. The index index is
0-based. kEnd : Search to the end of the text |
static int table::count(
ItemRef frameRef,
int textStart = -1,
int textLen = -1)
Number of tables in the text. The first parameter of this function is new from Version 1.1.6. Older version use the function without this parameter.
| Name | Type | Default | Description |
| Return | int | Number of tables in the text | |
| frameRef | ItemRef | - | From Version 1.1.6 Frames the text of which the tables are to be created in. 0 : : Current script frame otherwise : Valid reference of a text frame |
| textStart | int | -1 | Search the i-th tables starting from a defined text position.. -1 : Count the entire text kSelection : Count in the current selection |
| textLen | int | -1 | Only count in a part of the text. kEnd : Count to the end |
How many tables are in the text. If it contains at least one table, then we will want to know how big the table is.
int main ()
{
int i = 0;
Table T = table::alloc ();
int cnt = table::count (0);
if (!T) return 0;
showmessage ("%d",cnt);
while (i < cnt)
{
table::get (T, 0, i);
showmessage ("Table %d : %d x %d",
i,
table::rows (T),
table::columns (T));
i++;
}
table::release (T);
return 0;
}
static int table::rows(Table T, int rowType = 0)
Count the lines of a table.
| Name | Type | Default | Description |
| Return | int | Line count | |
| T | Table | - | table used |
| rowType | int | kAllRows | Count this type of rows. InDesign 2.0 always returns the total number of rows. kAllRows kHeaderRows kBodyRows kFooterRows |
Count the rows of a table.
#include "internal/table.h"
int main () { Table T = table::alloc ();
if (!T) return 0; if (table::get (T, 0, 0) != 0) { showmessage ("Keine Tabelle im Text"); table::release (T); return 0; }
showmessage ("%d Row(s)", table::rows (T, kAllRows)); showmessage ("%d Header row(s)", table::rows (T, kHeaderRows)); showmessage ("%d Body row(s)", table::rows (T, kBodyRows)); showmessage ("%d Footer row(s)", table::rows (T, kFooterRows));
table::release (T); return 0; }
static int table::get_rows(Table T, int rowType = 0)
Synonym for rows.
static int table::columns(Table T)
Count the columns of a table.
| Name | Type | Default | Description |
| Return | int | Column count | |
| T | Table | - | table used |
static int table::get_columns(Table T)
Synonym for columns
static int table::get_cellsize(
Table T,
int x,
int y,
int insetRelative,
float* width,
float* height)
Size of a table cell in points
static int table::get_cellbox(
Table T,
int x,
int y,
int insetRelative,
float* left,
float* top,
float* right,
float* bottom,
ItemRef parentRef = 0,
int* first_row_in_frame = 0,
int* pg = 0,
char* lay = 0)
Ascertain the frame of a table cell. The result is returned in points.
static int table::get_cellinsets(
Table T,
int x,
int y,
float* left,
float* top,
float* right,
float* bottom)
Insets of a table cell
static int table::insert_rows(
Table T,
int at,
int how_many,
int before_or_after = eAfter,
float height = 0.0,
int clearTags = 0)
Insert rows into a table. The function inserts the desired number of rows into the table either before or after the specified row. If the specified row is a header or footer, headers or footers are inserted accordingly.
| Name | Type | Default | Description |
| Return | int | 0 or ErrorCode | |
| T | Table | - | Valid table reference |
| at | int | - | Where are the rows to be inserted? < 0 : First body row ≥ Number of rows incl. headers and footers : Last body row otherwise : 0-based row index. If the index points to a header or footer, headers or footers are created accordingly. |
| how_many | int | - | How many rows should be inserted? |
| before_or_after | int | 1 | eBefore : insert before the row at eAfter insert after the row at |
| height | float | InDesign® settings | Row height. If the value is missing or is 0.0, InDesign® will determine a standard height |
| clearTags | int | 0 | Clear all placeholders at the inserted cells. 1 : Yes. Recommended! 0 : No |
Replace the text of the current script frame with a 2x4 table. For demonstration purposes, four additional rows are then added to the new table.
int main ()
{
int T = table::alloc ();
if (!T) return 0;
if (table::create (T, 2, 4) != 0)
{
table::release (T);
return 0;
}
table::insert_cols (T, 1, 4, eAfter, 12.0, 1);
table::release (T);
return 0;
}
static int table::insert_cols(
Table T,
int at,
int how_many,
int before_or_after = eAfter,
float width = 0.0,
int clearTags = 0)
Insert new columns into a table. The function inserts the desired number of columns into the table either before or after the specified column.
| Name | Type | Default | Description |
| Return | int | 0 or ErrorCode | |
| T | Table | - | Valid table reference |
| at | int | - | Where are the columns to be inserted? < 0 : Last column ≥ number of colums : Last column otherwise : 0-based index of column |
| how_many | int | - | How many columns should be inserted? |
| before_or_after | int | 1 | eBefore : insert before the column at eAfter : insert after the column at |
| width | float | InDesign® settings | Column(s) width. If the value is missing or is 0.0, InDesign® will determine a standard width. |
| clearTags | int | 0 | Clear all placeholders in the inserted cells. 1 : Yes. Recommended! 0 : No |
static int table::resize_rows(
Table T,
int at,
int how_many,
float height,
float min_height =-1.0,
float max_height =-1.0)
Change the height of row of a table. Besides the current row height, the maximum and minimum rows height may be changed. InDesign® uses this specification to optimise the appearance of the table. If the new row height lies outside the current value of minimum and maximum these limits will be changed accordingly. If you want to change the minimum and/or maximum, insert the value 0.0 for the height. To change column widths use the analogous function resize_cols.
| Name | Type | Default | Description |
| Return | int | 0 or ErrorCode | |
| T | Table | - | Table used |
| at | int | - | First row to change |
| how_many | int | - | How many rows are to be changed? -1 : All further rows including at |
| height | float | - | New height 0.0 : Ignore value and use min_height and max_height Values > 0.0 are supported for back compatibility only. Please use min_height and max_height instead. |
| min_height | float | -1.0 | New minimum height < 0.0 : Ignore value. Ignored by Illustrator. |
| max_height | float | -1.0 | New minimum height < 0.0 : Ignore value. If min_height und max_height are equal and > 0.0 the rows will get this exact height, otherwise InDesign® can change the height(s) in the given range. Ignored by Illustrator. |
table::resize_rows (T, at, rows, height, hmin, hmax);
Change all row heights and column widths of a table.
int main ()
{
Table T = table::alloc ();
if (!T) return 0;
if (table::get (T, 0, 0) != 0)
{
table::relase (T);
return 0;
}
table::resize_cols (T, 0, -1, 8.0);
table::resize_rows (T, 0, -1, 8.0);
table::relase (T);
return 0;
}
static int table::resize_cols(
Table T,
int at,
int how_many,
float width)
Change the width of columns of a table.
| Name | Type | Default | Description |
| Return | int | 0 or ErrorCode | |
| T | Table | - | Table used |
| at | int | - | First column to change |
| how_many | int | - | How many columns are to be changed? -1 : All further columns including at |
| width | float | - | New width of the columns |
Change all row heights and column widths of a table.
int main ()
{
Table T = table::alloc ();
if (!T) return 0;
if (table::get (T, 0, 0) != 0)
{
table::relase (T);
return 0;
}
table::resize_cols (T, 0, -1, 8.0);
table::resize_rows (T, 0, -1, 8.0);
table::relase (T);
return 0;
}
static int table::move_rows(
Table T,
int at,
int how_many,
int to,
int duplicate = 0,
int* cl = 0,
int* cr = 0)
Move rows within a table.
| Name | Type | Default | Description |
| Return | int | 0 or ErrorCode | |
| T | Table | - | Valid Table reference |
| at | int | - | 0-based index of the first row to be moved |
| how_many | int | - | > 0 : Number of rows to be moved. This action can split merged cells!
In comet_pdf this parameter is ignored and 0 is used always! ≤ 0 : At least one row is moved. If the row contains vertical merged cells, the affected rows will be moved as well. |
| to | int | - | 0-based index of target row. Please note that header rows can only be moved inside the table header,
body rows inside the body and footer rows only inside the footer.
within the table body. -1 : Insert at the end. The function checks whether header, body, or footer rows are are moved and calculates the corresponding index automatically. |
| duplicate | int | 0 | Copy rows (instead of just moving them). The parameter is ignored by comet_pdf! |
| cl | int* | 0 | If the execution is successful, the variable will contain the 0-based index of the first moved (duplicated) row. |
| cr | int* | 0 | On successful execution, the variable contains the 0-based index of the first line after *cl which was not moved/duplicated. |
static int table::move_cols(
Table T,
int at,
int how_many,
int to,
int duplicate = 0,
int* cl = 0,
int* cr = 0)
Move columns within a table.
| Name | Type | Default | Description |
| Return | int | 0 or ErrorCode | |
| T | Table | - | Valid Table reference |
| at | int | - | 0-based index of the first column to be moved |
| how_many | int | - | > 0 : Number of columns to be moved. This action can split merged cells!
In comet_pdf this parameter is ignored and 0 is used always! ≤ 0 : At least one column is moved. If the column contains horizontal merged cells, the affected columns will be moved as well. |
| to | int | - | 0-based index of target column. -1 : Insert at the end. |
| duplicate | int | 0 | Copy columns (instead of just moving them). The parameter is ignored by comet_pdf! |
| ct | int* | 0 | If the execution is successful, the variable will contain the 0-based index of the first column (duplicated) row. |
| cb | int* | 0 | On successful execution, the variable contains the 0-based index of the first column after *ct which was not moved/duplicated. |
static int table::mirror(Table T)
Swap the columns of a table. In addition to the columns, the function also swaps the right and left cell strokes with each other. In addition, the specifications for alternating columns are adapted to the mirroring.
Please note the following limitations of the function:
| Name | Type | Default | Description |
| Return | int | 0 or ErrorCode | |
| T | Table | - | Valid Table reference |
static int table::remove_rows(
Table T,
int at,
int how_many)
Remove rows of a table. The function also deletes headers and footers. You specify the first row to be deleted and the number.
When trying to delete all body rows of the table, the function generates the error tableIndexErr (= 12).
| Name | Type | Default | Description |
| Return | int | 0 or ErrorCode | |
| T | Table | - | Table used |
| at | int | - | Where are the rows to be deleted? |
| how_many | int | - | > 0 Number of rows -1 : All further rows including at |
table::remove_rows (T, at, rows); table::remove_cols (T, at, cols);
Get the first table of the current text. If the table does not exist, an error message is shown. The third and fourth columns will be deleted from the identified table.
int main ()
{
Table T = table::alloc ();
if (!T) return 0;
if (table::get (T, 0, 0) != 0)
{
table::relase (T);
showerror ("The text does not contain a table.");
return 0;
}
table::remove_rows (T, 2, 2);
table::relase (T);
return 0;
}
static int table::remove_cols(
Table T,
int at,
int how_many)
Deleting columns of a table. You specify the first column to be deleted and the number.
| Name | Type | Default | Description |
| Return | int | 0 or ErrorCode | |
| T | Table | - | Table used |
| at | int | - | Where are the columns to be deleted? |
| how_many | int | - | > 0 Number of columns -1 : All further columns including at |
static int table::convert_to_headerrows(Table T, int rows = 1)
Convert body rows to header rows. The first normal table row is always used as the starting row. After the conversion, the table must still contain at least contain at least one normal line. The function restricts the range of rows to be converted if required.
| Name | Type | Default | Description |
| Return | int | 0 or ErrorCode | |
| T | Table | - | Valid table reference |
| rows | int | 1 | number of body rows to convert At least one row will kept as body row in the table automatically. |
static int table::convert_to_bodyrows(
Table T,
int at,
int rows = 1)
Convert header or footer rows to body rows.
| Name | Type | Default | Description |
| Return | int | 0 or ErrorCode | |
| T | Table | - | Valid table reference |
| at | int | - | First row (0-based) to be converted. |
| rows | int | 1 | Number of rows to be converted into body rows. If required, the number is limited to rows (T, kBodyRows) - 1. |
static int table::convert_to_footerrows(Table T, int rows = 1)
Convert table body rows into footer rows. The row that is rows above the first footer row is always used as the starting row. The function restricts the range of rows to be converted as required.
| Name | Type | Default | Description |
| Return | int | 0 or ErrorCode | |
| T | Table | - | Valid table reference |
| rows | int | 1 | Number of body rows to convert At least one row will kept as body row in the table automatically. |
static int table::colorize(
Table T,
int left,
int top,
int rigth,
int bottom,
char* color_name,
float tint =0.0)
Background color of fields in a table. The background can either be defined using the color fields or by using the RGB.
| Name | Type | Default | Description |
| Return | int | 0 or ErrorCode | |
| T | Table | - | Table used |
| left | int | - | first column (0-based) |
| top | int | - | first row (0-based) |
| right | int | - | >= 0 : first column that is not to edited further (0-based) -1 : All further columns of the table |
| bottom | int | - | >= 0 : first row that is not to be edited further (0-based) -1 : All further rows of the table |
| ⇨ Color definition by named swatch | |||
| color_name | String or char* | - | Name of a color definition from the color field or base color "" : leave color untouched |
| tint | float | 100.0 | Opacity of the color in % (0.0 - 100.0) |
| ⇨ Color definition by RGB values | |||
| red | int | - | Red portion of the color (0-255) |
| green | int | - | Green portion of the color (0-255) |
| blue | int | - | Blue portion of the color (0-255) |
| tint | float | 100.0 | Tint of the color % (0.0-100.0). Tint is only applied, if new_name is given -1.0 : leave untouched |
| new_name | String or char* | "" | If a name is defined the applied color will be stored under this name as a color field |
table::colorize (T, l, t, r, b, colname, tint); table::colorize (T, l, t, r, b, red, green, blue, tint, nname);
In the first table of the text, the second column in the second and third row is to be colorized dark orange.
int main ()
{
Table T = table::alloc ();
if (!T) return 0;
if (table::get (T, 0, 0) != 0)
{
table::release (T);
return 0;
}
table::colorize (T, 1, 1, 2, 2, "dark orange", 50.0);
table::release (T);
return 0;
}
In the first table of the text, the second column in the second and third row is to be colorized red.
int main ()
{
Table T = table::alloc ();
if (!T) return 0;
if (table::get (T, 0, 0) != 0)
{
table::release (T);
return 0;
}
table::colorize (T, 1, 1, 2, 2, 255, 30, 30, 100.0);
table::release (T);
return 0;
}
static int table::colorize_cmyk(
Table T,
int left,
int top,
int right,
int bottom,
float c,
float m,
float y,
float k,
float tint = 100.0,
char* new_name = 0)
CMYK Background color of table cells.
| Name | Type | Default | Description |
| Return | int | 0 or ErrorCode | |
| T | Table | - | Table used |
| left | int | - | first column (0-based) |
| top | int | - | first row (0-based) |
| right | int | - | >= 0 : first column that is not to edited further (0-based) -1 : All further columns of the table |
| bottom | int | - | >= 0 : first row that is not to be edited further (0-based) -1 : All further rows of the table |
| ⇨ Color definition by CMYK values | |||
| c, m, y, k | float, float, float, float - | Color portions (0.0 - 1.0) | |
| tint | float | 100.0 | Tint of the color % (0.0-100.0). Tint is only applied, if new_name is given -1.0 : leave untouched |
| new_name | String or char* | "" | If a name is defined the applied color will be stored under this name as a color field |
static int table::colorize_rows(
Table T,
int at,
int how_many,
char* color_name,
float tint = 100.0)
Set the background color of rows.
| Name | Type | Default | Description |
| Return | int | 0 or ErrorCode | |
| T | Table | - | Table |
| at | int | - | At what position are the rows to be changed? |
| how_many | int | - | How many rows are to be changed? -1 : All further rows including at |
| ⇨ Color definition by named swatch | |||
| color_name | String or char* | - | Name of a color definition from the color field or base color "" : Leave untouched |
| tint | float | 100.0 | Opacity of the color in % (0.0 - 100.0) -1.0 : Leave untouched |
| ⇨ Color definition by RGB values | |||
| red | int | - | Red portion of the color (0-255) |
| green | int | - | Green portion of the color (0-255) |
| blue | int | - | Blue portion of the color (0-255) |
| tint | float | 100.0 | Opacity of the color % (0.0-100.0), Values other than 100% are only applied, if the color gets a name! -1.0 : Leave untouched |
| new_name | String or char* | "" | If a name is defined the applied color will be stored under this name as a color field |
In the first table of the text the second and third rows are to be given a dark orange background
int main ()
{
Table T = table::alloc ();
if (!T) return 0;
if (table::get (T, 0, 0) != 0)
{
table::release (T);
return 0;
}
table::colorize_rows (T, 1, 2, "Dark orange", 25.0);
table::release (T);
return 0;
}
IIn the first table of the text the second and third rows are to be given a strong red background
int main ()
{
Table T = table::alloc ();
if (!T) return 0;
if (table::get (T, 0, 0) != 0)
{
table::release (T);
return 0;
}
table::colorize_rows (T, 1, 2, 255, 30, 30, 100.0);
table::release (T);
return 0;
}
static int table::colorize_cols(
Table T,
int at,
int how_many,
char* color_name,
float tint = 100.0)
Set the background color of columns. See colorize_rows.
static int table::set_overprint(
Table T,
int left,
int top,
int right,
int bottom,
int overprint)
Set the "overprint" property of table cells.
| Name | Type | Default | Description |
| Return | int | 0 or ErrorCode | |
| T | Table | - | valid table refenrece |
| left | int | - | first column (0-basiert) |
| top | int | - | first row (0-basiert) |
| right | int | - | >= 0 : first column not to be changed (0-basiert) -1 end of table |
| bottom | int | - | >= 0 : first row not not to be changed (0-basiert) -1 end of table |
| overprint | int | - | 0 : off 1 : on |
static int table::inset(
Table T,
int left,
int top,
int right,
int bottom,
int sides,
float new_inset)
Change the spacing of the contents in rows (inset_rows), columns (inset_cols) or table fields (inset) from the edge of the cell.
| Name | Type | Default | Description |
| Return | int | 0 or ErrorCode | |
| T | Table | - | Table used |
| ⇨ Rows or columns | |||
| at | int | - | Where are the rows/columns to be changed? |
| how_many | int | - | How many rows/columns are to be changed? -1 All other rows/columns including at |
| ⇨ Table fields | |||
| left | int | - | first column (0-based) |
| top | int | - | first row (0-based) |
| right | int | - | >= 0 : first column that is not to be edited further (0-based) -1 : All further columns of the table |
| bottom | int | - | >= 0 : first row that is not to be edited further (0-based) -1 : All further rows of the table |
| ⇨ General parameter | |||
| sides | int | - | eLeftSide eRightSide eTopSide eBottomSide eAllSides |
| new_inset | float | - | Spacing in points |
table::inset_rows (T, at, rows, sides, new_inset); table::inset_cols (T, at, cols, sides, new_inset); table::inset (T, l, t, r, b, sides, new_inset);
static int table::rotate(
Table T,
int left,
int top,
int right,
int bottom,
float degrees)
Alignment of rows (inset_rows), columns (inset_cols) or table fields (inset). For the rotation only multiples of 90.0 are permitted.
| Name | Type | Default | Description |
| Return | int | 0 or ErrorCode | |
| T | Table | - | Table used |
| ⇨ Rows or columns | |||
| at | int | - | Where are the rows/columns to be changed? |
| how_many | int | - | How many rows/columns are to be changed? -1 All other rows/columns including at |
| ⇨ Table fields | |||
| left | int | - | first column (0-based) |
| top | int | - | first row (0-basiert) |
| right | int | - | >= 0 : first column that is not to be edited further (0-based) -1 : All further columns of the table |
| bottom | int | - | >= 0 : first row that is not to be edited further (0-based) -1 : All further rows of the table |
| ⇨ General parameters | |||
| sides | int | - | The pages affected are specified as the sum of the following values: eLeftSide eRightSide eTopSide eBottomSide eAllSides |
| degrees | float | - | Angle in degrees. For the rotations only multiples of 90.0 are permitted. |
table::rotate_rows (T, at, rows, degrees); table::rotate_cols (T, at, cols, degrees); table::rotate (T, l, t, r, b, degrees);
static int table::stroke(
Table T,
int left,
int top,
int right,
int bottom,
int sides,
...)
Framing of rows (stroke_rows), columns (stroke_cols) or table fields (stroke).
| Name | Type | Default | Description |
| Return | int | 0 or ErrorCode | |
| T | Table | - | Table used |
| ⇨ Rows or columns | |||
| at | int | - | Where are the rows/columns to be changed? |
| how_many | int | - | How many rows/columns are to be changed? -1 All other rows/columns including at |
| ⇨ Table fields | |||
| left | int | - | first column (0-based) |
| top | int | - | first row (0-basiert) |
| right | int | - | >= 0 : first column that is not to be edited further (0-based) -1 : All further columns of the table |
| bottom | int | - | >= 0 : first row that is not to be edited further (0-based) -1 : All further rows of the table |
| ⇨ General parameters | |||
| sides | int | - | The sides affected are specified as the sum of the following values.
eLeftSide, eRightSide, ... are treated as to be the outer edges of the current cell range, not the edges of every cell. eLeftSide eRightSide eTopSide eBottomSide eInteriorRows eInteriorCols eBottomSide eAllSides |
| ⇨ A user-defined number of value pairs of the following type may follow | |||
| eWeight, weight | 1, float | - | Line strength in points |
| eColor, colName | 2, String or char* | - | Name of a defined color in the document or base color |
| eRGBColor, r, g, b | 256, int, int, int | - | RGB value of the line color (each 0-255) |
| eLineType, linetype | 4, int | - | Line type(s) eNone eSolid eThickThick eThinThin eThickThin eThinThick eThickThinThick eThinThickThin since Version 1.1.19 (8. April 2004): eDashed eDash4X4 eDash3X2 eDots eWavy eStraightHash eRightSlant eLeftSlant eDiamond eJapaneseDots eTriple eTableStrip Ignored by Illustrator. |
| eTint, tint | 8, float | - | How strong is the color to be (0.0-100.0) The factor will only be used for colors, which can be selected using their names. |
| eOverprint, ov | 16, int | - | Overprint stroke color? 0: No 1: Yes Ignored by Illustrator. |
| eGapColor, name | 32, String or char* | - | Name of the color defined in the document or a base color for the gap in the edges (since Version 1.1.19 8 April 2004)
Ignored by Illustrator. |
| eGapRGBColor, r, g, b | 257, int, int, int | - | RGB color value (each 0-255) for the gap in the edges (since Version 1.1.19 8 April 2004)
Ignored by Illustrator. |
| eGapTint, tint | 64, float | - | How strong is the color for the edge gaps to be (0.0-100.0) (since Version 1.1.19 8 April 2004) The factor will only be used for colors, which can be selected using their names. Ignored by Illustrator. |
| eGapOverprint, ov | 128, int | - | Overprint gap color of strokes? (since Version 1.1.19 8 April 2004) 0: No 1: Yes Ignored by Illustrator. |
table::stroke_rows (T, at, rows, sides, ...); table::stroke_cols (T, at, cols, sides, ...); table::stroke (T, l, t, r, b, sides, ...);
#include "internal/table.h" int main () { Table T = table::alloc ();
if (!T) return 0;
if (table::get (T, 0, 0) != 0) { table::release (T); return 0; }
table::stroke ( T, 1, 1, 3, 3, eInteriorRows + eInteriorCols, eWeight, 3.0, eRGBColor, 255, 0, 0, eTint, 0.5 eLineType, eThickThick);
table::release (T);
return 0; }
static int table::reset_stroke(
Table T,
int left,
int top,
int right,
int bottom,
int sides,
int attrib)
Method to remove stroke-overrides from specified sides of cells in given area. Use rows (reset_stroke_rows) resp. (reset_stroke_cols) for rows or columns.
| Name | Type | Default | Description |
| Return | int | 0 or ErrorCode | |
| T | Table | - | Table used |
| ⇨ Rows or columns | |||
| at | int | - | Where are the rows/columns to be changed? |
| how_many | int | - | How many rows/columns are to be changed? -1 All other rows/columns including at |
| ⇨ Table fields | |||
| left | int | - | first column (0-based) |
| top | int | - | first row (0-basiert) |
| right | int | - | >= 0 : first column that is not to be edited further (0-based) -1 : All further columns of the table |
| bottom | int | - | >= 0 : first row that is not to be edited further (0-based) -1 : All further rows of the table |
| ⇨ Allgemeine Parameter | |||
| sides | int | - | The affects pages are specified as the sum of the following values.
eLeftSide, eRightSide, ... are treated as to be the outer edges of the current cell range, not the edges of every cell. eLeftSide eRightSide eTopSide eBottomSide eInteriorRows eInteriorCols eBottomSide eAllSides |
| attrib | int | - | Sum of the following values: eWeight eColor eLineType eTint eOverprint |
table::reset_stroke_rows (T, at, rows, sides, attrib); table::reset_stroke_cols (T, at, cols, sides, attrib); table::reset_stroke (T, l, t, r, b, sides, attrib);
static int table::split(
Table T,
int left,
int top,
int direction)
Splitting a table field. As the numbering of the rows and columns changes when cells are split and the splitting of cell ranges therefore produces surprising results, the function only works on single cells.
Cell splits will create a new row or column! All row or column indices of subsequent rows or columns are repositioned and the table has one row/column more.
| Name | Type | Default | Description |
| Return | int | 0 or ErrorCode | |
| T | Table | - | Table used |
| left | int | - | Column (0-based) -1 : Last table column |
| top | int | - | Row (0-based) -1 : Last table row |
| direction | int | - | eVertical eHorizontal |
static int table::merge(
Table T,
int left,
int top,
int right,
int bottom,
int copyPolicy = 0,
char* delimText = 0,
int autoExtend = 0)
Merge a table area to a cell.
If the cells of entire rows and/or columns are merged, the number of rows/columns of the table will become smaller. This will change the following line/column numbers!
The desired cell range can be chosen such that it contains larger cell areas itself. Since cell areas must always be rectangular, InDesign® can NOT create such areas!
Here is an example

The direct merge of the red cell with the first pink would create a non-rectangulare cell area.
For a rectangular cell range, the following rows/columns would also be required:
And this would mean: The whole table becomes a single cell.
The automatic area adjustment described above is done automatically, if the parameter autoExtend is set to 1. Otherwise the function will return the error 1303 (cannotMergeCellsErr) in case of unmergable areas.
| Name | Type | Default | Description |
| Return | int | 0 or ErrorCode | |
| T | Table | - | Table used |
| left | int | - | Column (0-based) |
| top | int | - | Row (0-based) |
| right | int | - | >= 0 : first column, which is not to be edited any further (0-based) -1 : All further columns of the table |
| bottom | int | - | >= 0 : first row, which is not to be edited any further (0-based) -1 : All further rows of the table |
| copyPolicy | int | 0 | How to deal with the 'old' cell content? 0 : InDesign® standard behavior. Add the content of the merged cell paragraph delimited to the merged cell. 1 and 2 : Content is added to the merged cell too but delimited by text given in parameterdelimText. Using 1 we are walking from left to right to every row. Using 2 we are walking from top to bottom through every column. If visited cells having the same content, the content is taken only once. Values 1 and 2 are not supported by comet_pdf or Illustrator for now. |
| delimText | String or char* | 0 | Text between the content of the merged cells. May be TaggedText. In case of copyPolicy == 0 this text is ignored of course. |
| autoExtend | int | 0 | Behavior on area errors, see here 1 : self-extend area otherwise : return error 1303 (cannotMergeCellsErr) |
static int table::merge_equal(
Table T,
int direction = 0,
int ckeckPgBreaks = 0,
int compareFunction = 0,
int left = 0,
int top = 0,
int right = -1,
int bottom = -1,
int xjustify_h = -1,
int yjustify_h = -1,
int xjustify_v = -1,
int yjustify_v = -1,
int flags = 0,
int* counter = 0)
Merge cells with same content.
Merging cell may change row heights. This may change the frame breaks of the table.
[Since v4.1.6 R25052] In addition to the text content, the inlines in the text are also checked. It applies:
| Name | Type | Default | Description |
| Return | int | 0 or ErrorCode | |
| T | Table | - | Table used |
| direction | int | 0 | Search and merge direction 0 : column wise 1 : row wise 2 : both directions (same like calling the function twice, first row wise, than column wise merges) |
| ckeckPgBreaks | int | 0 | Take care on page breaks while merging? 0 : No 1 : Yes. In this case, cells on different frames of the text chain are never merges. |
| compareFunction | int | 0 | How should cell content be compared? 0 : Compare tagged text 1 : Compare Placeholders. The created and modified fields of the placeholder are ingored, while comparing placeholders. 2 : Compare plaintext of the cells. 3 : Compare plaintext of the cells as net weight strings. |
| left | int | 0 | First column of cell area to work on (0-based) |
| top | int | 0 | First row of cell area to work on (0-based) |
| right | int | -1 | End of area to work on. This is the first column outside the area! -1 : enbd of table |
| bottom | int | -1 | End of area to work on. This is the first row outside the area! -1 : enbd of table |
| xjustify_h | int | -1 | Horizontal justification of cells merged in rows -1 : don't change 0 : left 1 : centered 2 : right 3 : system 4 : justify left 5 : justify center 6 : justify right 7 : auto 8 : to binding 9 : away from binding |
| yjustify_h | int | -1 | Vertical justification of cells merged in rows -1 : don't change 0 : top 1 : centered 2 : bottom |
| xjustify_v | int | -1 | Horizontal justification of cells merged in columns -1 : don't change 0 : left 1 : centered 2 : right 3 : system 4 : justify left 5 : justify center 6 : justify right 7 : auto 8 : to binding 9 : away from binding |
| yjustify_v | int | -1 | Vertical justification of cells merged in columns -1 : don't change 0 : top 1 : centered 2 : bottom |
| flags | int | 0 | Bit field for adjusting the behavior of the function 1 : Cells that have already been merged may be included in new merges. If the option is not set, cells under a cell range with the same content will not be added to the cell range. 2 : Search also below/behind the start cell for cell areas with the same content. See, for example the following columns: aaa | aaa | bbb | bbb | ccc If the option is not set, only the cells aaa | aaa are merged together. If the option is set, also the cells bbb | bbb are merged together. |
| counter | int* | 0 | Number of newly created cell merges after execution of the function |
int main ()
{
Table T = table::alloc ();
int result;
result = table::get (T, 0, 0);
result = table::merge_equal (
T,
0,
1,
1,
0, 0, -1, -1,
1, 1,
1, 1);
wlog ("", "Result = %d\n", result);
return 0;
}
static int table::merge_equal_fr(
Table T,
ItemRef fr = 0,
int compareFunction = 0,
int left = 0,
int right = -1,
int xjustify_h = -1,
int yjustify_h = -1,
int xjustify_v = -1,
int yjustify_v = -1,
int flags = 0,
int* counter = 0)
Merge cells with the same content in a given frame. In contrast to table::merge_equal, only cells that are in the given frame are merged. If these rows are getting lower by the merge, further possible cells from the subsequent frames are automatically included in the merge.
The function only provides useful results in single-column texts. The function is not suitable for multi-column text frames!
In comet_pdf the function is available, but works like table::merge_equal!
The screenshot shows a table in which table::merge_equal makes some cells so tall that they can no longer be displayed in any frame of the text chain.
In the second screenshot, the merge was only applied to the rows of the blue frame. As you can see, merge_equal_fr not only merges the original four rows of the blue frame but also "sees" that additional rows fit into the blue frame after the first four lines have been merged.

Merging cell may change row heights. This may change the frame breaks of the table.
In addition to the text content, the inlines in the text are also checked. It applies:
| Name | Type | Default | Description |
| Return | int | 0 or ErrorCode 1244 : The table is not in the text chain of fr The function only provides useful results in single-column texts. The function is not suitable for multi-column text frames! |
|
| T | Table | - | Valid table reference |
| fr | ItemRef | 0 | Valid frame reference. If the frame does not contain any rows from table T, the entire table is processed. 0 : Current script frame |
| compareFunction | int | 0 | How should cell content be compared? 0 : Compare tagged text 1 : Compare Placeholders. The created and modified fields of the placeholder are ingored, while comparing placeholders. 2 : Compare plaintext of the cells. 3 : Compare plaintext of the cells as net weight strings. |
| left | int | 0 | First column of cell area to work on (0-based) |
| right | int | -1 | End of area to work on. This is the first column outside the area! -1 : enbd of table |
| xjustify_h | int | -1 | Horizontal justification of cells merged in rows -1 : don't change 0 : left 1 : centered 2 : right 3 : system 4 : justify left 5 : justify center 6 : justify right 7 : auto 8 : to binding 9 : away from binding |
| yjustify_h | int | -1 | Vertical justification of cells merged in rows -1 : don't change 0 : top 1 : centered 2 : bottom |
| xjustify_v | int | -1 | Horizontal justification of cells merged in columns -1 : don't change 0 : left 1 : centered 2 : right 3 : system 4 : justify left 5 : justify center 6 : justify right 7 : auto 8 : to binding 9 : away from binding |
| yjustify_v | int | -1 | Vertical justification of cells merged in columns -1 : don't change 0 : top 1 : centered 2 : bottom |
| flags | int | 0 | Bit field for adjusting the behavior of the function 1 : Cells that have already been merged may be included in new merges. If the option is not set, cells under a cell range with the same content will not be added to the cell range. 2 : Search also below/behind the start cell for cell areas with the same content. See, for example the following columns: aaa | aaa | bbb | bbb | ccc If the option is not set, only the cells aaa | aaa are merged together. If the option is set, also the cells bbb | bbb are merged together. |
| counter | int* | 0 | Number of newly created cell merges after execution of the function |
int main ()
{
Table T = table::alloc ();
int result;
result = table::get (T, 0, 0);
result = table::merge_equal (
T,
0,
1,
1,
0, 0, -1, -1,
1, 1,
1, 1);
wlog ("", "Result = %d\n", result);
return 0;
}
static int table::unmerge(
Table T,
int left,
int top)
Reverse the merging of several table cells to one cell.
Unmerging a cell area creates new rows and/or columns in the table. The table will be larger therefore and all subsequent columns/line indices are shifted accordingly.
| Name | Type | Default | Description |
| Return | int | 0 or ErrorCode | |
| T | Table | - | Table used |
| left | int | - | Column (0-based) |
| top | int | - | Row (0-based) |
static int table::clear(
Table T,
int left,
int top,
int right,
int bottom)
Clear contents of given table cells.
| Name | Type | Default | Description |
| Return | int | 0 or ErrorCode | |
| T | Table | - | Table used |
| left | int | - | first Column (0-based) |
| top | int | - | first Row (0-based) |
| right | int | - | >= 0 : first column, which is not to be edited any further (0-based) -1 : All further columns of the table |
| bottom | int | - | >= 0 : first row, which is not to be edited any further (0-based) -1 : All further rows of the table |
static int table::set_text(
Table T,
int left,
int top,
char* str,
int insert_pos =0,
int remove_len =-1,
int autoload = 0)
Set the text of a table field.
static char* table::get_text(
Table T,
int left,
int top,
char* str,
int fmt = kExportPlain)
Get the text of a table field The result string must be sufficiently large in order to accommodate the result.
static int table::get_textpos(
Table T,
int* start,
int* len)
Text position and length of a table. The function return the position and length of the table content. Cell content is hold return-delimited behind the textmodels content. Inside this content only an anchor points to the cell content. To get the tables anchor position please use table::get_anchorpos.
The function returns results even if a table cell in in overset. To find out, if a cell in overset, use the following test :
table::cell::get_textpos (T, col, row, &start, &len);
if (textmodel::position_visible (gFrame, start))
| Name | Type | Default | Description |
| Return | int | 0 or ErrorCode | |
| T | Table | - | Valid table reference |
| start | int* | - | Position in the text model at which the tables text starts. |
| len | int* | - | Length of the text of the table. |
Get all inlines of the currently selected table cell.
ItemList inlines_of_cell (ItemRef frame, Table T, int row, int col)
{
ItemList inlines = itemlist::inlines (frame);
ItemList cellframes = itemlist::alloc ();
ItemRef f = item::alloc ();
int start, len, pos, i;
table::cell::get_textpos (T, col, row, &start, &len);
for (i = 0; i < itemlist::length (inlines); i++)
{
itemlist::get (inlines, f, i);
pos = frame::inlinepos (f);
if (pos >= start)
{
itemlist::append (cellframes, f);
}
}
itemlist::release (inlines);
return cellframes;
}
int main ()
{
int start, end, row, col;
Table T = table::alloc ();
ItemRef frame = item::alloc ();
ItemList inlines;
textmodel::selection (&start, &end, frame, 0, T, &col, &row);
if (table::is_valid (T))
{
inlines = inlines_of_cell (frame, T, row, col);
wlog ("", "# %d inlines in cell [r%d, c%d]\n", itemlist::length (inlines), row, col);
itemlist::release (inlines);
}
return 0;
}
static int table::get_anchorpos(Table T, int* len = 0)
Text position and length of a table anchor. Cell content is hold return-delimited behind the textmodels content. Inside this content only an anchor points to the cell content. To get the position of the cell content please use table::get_textpos.
| Name | Type | Default | Description |
| Return | int | -1 or start index of the anchor | |
| T | Table | - | Valid table reference |
| len | int* | 0 | Length of the anchor. |
static int table::style(
Table T,
int left,
int top,
int right,
int bottom,
int styl = 0,
int on_off= 1,
int start_pos = 0,
int len =-1)
Set the text style of fields. For bold and italic various font types are used. It is therefore possible that this setting can be used for a cetain font. If a cutting is set that does not exist, InDesign® will mark the corresponding text part with this font, but will comment with each opening of the document that a style could not be found.
| Name | Type | Default | Description |
| Return | int | 0 or ErrorCode | |
| T | Table | - | Table used |
| left | int | - | first Column (0-based) |
| top | int | - | first Row (0-based) |
| right | int | - | >= 0 : first column, which is not to be edited any further (0-based) -1 : All further columns of the table |
| bottom | int | - | >= 0 : first row, which is not to be edited any further (0-based) -1 : All further rows of the table |
| styl | int | - | Text style, select a user-defined sum of the following values normal bold italic underline strikeout |
| on_off | int | on | on off |
| start_pos | int | 0 | Text position per cell from which the cell text formatting is to be change |
| len | int | -1 | Length of the text to which the cell text formatting is to be change -1 : To the end of the cell text |
int main ()
{
Table T = table::alloc ();
if (!T) return 0;
if (table::get (T, 0, 0) != 0)
{
table::release (T);
return 0;
}
table::style (T, 0, 1, -1, 3, italic, on);
table::style_rows (T, 1, 0, 3, -1,
strikeout + underline,
on);
table::release (T);
return 0;
}
static int table::capital(
Table T,
int left,
int top,
int right,
int bottom,
int iCap =0,
int start_pos =0,
int len =-1)
Upper and lowercase in table fields
| Name | Type | Default | Description |
| Return | int | 0 or ErrorCode | |
| T | Table | - | Table used |
| left | int | - | first Column (0-based) |
| top | int | - | first Row (0-based) |
| right | int | - | >= 0 : first column, which is not to be edited any further (0-based) -1 : All further columns of the table |
| bottom | int | - | >= 0 : first row, which is not to be edited any further (0-based) -1 : All further rows of the table |
| iCap | int | - | Text stye, select a user-defined number of the following values kCapNormal kCapLowercase kCapAll |
| start_pos | int | 0 | Text position per cell from which the cell text formatting is to be change |
| len | int | -1 | Length of the text to which the cell text formatting is to be change -1 : To the end of the cell text |
int main ()
{
Table T = table::alloc ();
if (!T) return 0;
if (table::get (T, 0, 0) != 0)
{
table::release (T);
return 0;
}
table::capital (T, 0, 0, 2, 2, kCapLowercase);
table::release (T);
return 0;
}
static int table::position(
Table T,
int left,
int top,
int right,
int bottom,
int iPos =0,
int start_pos =0,
int len =-1)
Text positioning in table fields
| Name | Type | Default | Description |
| Return | int | 0 or ErrorCode | |
| T | Table | - | Table used |
| left | int | - | first Column (0-based) |
| top | int | - | first Row (0-based) |
| right | int | - | >= 0 : first column, which is not to be edited any further (0-based) -1 : All further columns of the table |
| bottom | int | - | >= 0 : first row, which is not to be edited any further (0-based) -1 : All further rows of the table |
| iCap | int | - | Text stye, select a user-defined number of the following values kPosNormal kPosHigh kPosLow |
| start_pos | int | 0 | Text position per cell from which the cell text formatting is to be change |
| len | int | -1 | Length of the text to which the cell text formatting is to be change -1 : To the end of the cell text |
int main ()
{
Table T = table::alloc ();
if (!T) return 0;
if (table::get (T, 0, 0) != 0)
{
table::release (T);
return 0;
}
table::position (T, 0, 0, 1, 1, kPosHigh, 1, 2);
table::position (T, 0, 0, 1, 1, kPosLow, 20, 1);
table::release (T);
return 0;
}
static int table::justification(
Table T,
int left,
int top,
int verticalJust,
int horizJust)
Justification of the cell contents. Using this function enables you to place the contents of table cells either
vertically or horizontally with the respective cell. To use the function the import
#include "internal/table.h"
#include "internal/text.h"
is required.
| Name | Type | Default | Description |
| Return | int | 0 or ErrorCode | |
| T | Table | - | Table used |
| ⇨ Single cell | |||
| left | int | - | 0-based column number of the cell |
| top | int | - | 0-based row number of the cell |
| ⇨ Cell range | |||
| left | int | - | 0-based column number of first the cell |
| top | int | - | 0-based row number of the first cell |
| right | int | - | 0-based first column number , which does not belong any longer to the area -1 : to the last table column |
| right | int | - | 0-based first row number , which does not belong any longer to the area -1 : to the last table row |
| verticalJust | int | - | Vertical position of the cell content kIgnoreJustify do not change property kTop kCenter kBottom kJustify Systemeinstellung |
| horizJust | int | - | Horizontal position of the cell content kIgnoreJustify do not change property kLeft kCenter kRight kJustify System-dependent kJustifyLeft System-dependent, last row left-justified kJustifyCenter System-dependent, last row centered kJustifyRight System-dependent, last row right-justified kJustifyAuto System-dependent, last row system-dependent kJustifyToBinding kJustifyAwayBinding |
Center the contents of all cells in the second table row.
table::justification ( t, 0, 1, //1st column, 2nd row -1, 2, //to the last column kCenter, kJustifyCenter);
static int table::cell_is_overset(
Table T,
int left,
int top,
int* ovIndex = 0)
Is there a text overset at the given table cell?
static int table::find_overset(
Table T,
int* left,
int* top)
Find the first cell in a table, that has a text overset.
| Name | Type | Default | Description |
| Return | int | - 0 : all cells are okay 1 : at leats one cell is overseted |
|
| left | int* | - | on return value 1 the first column´with an overset (0-based) |
| top | int* | - | on return value 1 the first row´with an overset (0-based) |
Check for overset in a table.
int main ()
{
Table T = table::alloc ();
int l, t;
if (table::get (T, 0, 0) != 0)
{
showmessage ("no table found");
table::release (T);
return 0;
}
if (table::find_overset (T, &l, &t))
{
showmessage ("overset (%d, %d)", t+1, l+1);
}
else showmessage ("are cells are fine");
table::release (T);
return 0;
}
static int table::size(
Table T,
int left,
int top,
int right,
int bottom,
float siz =10.0,
int start_pos =0,
int len =-1)
Fonts sizes in table fields
| Name | Type | Default | Description |
| Return | int | 0 or ErrorCode | |
| T | Table | - | Table used |
| left | int | - | first Column (0-based) |
| top | int | - | first Row (0-based) |
| right | int | - | >= 0 : first column, which is not to be edited any further (0-based) -1 : All further columns of the table |
| bottom | int | - | >= 0 : first row, which is not to be edited any further (0-based) -1 : All further rows of the table |
| siz | float | - | Text size in points |
| start_pos | int | 0 | Text position per cell from which the cell text formatting is to be change |
| len | int | -1 | Length of the text to which the cell text formatting is to be change -1 : To the end of the cell text |
int main ()
{
Table T = table::alloc ();
if (!T) return 0;
if (table::get (T, 0, 0) != 0)
{
table::release (T);
return 0;
}
table::size (T, 0, 0, 2, 2, 18.0);
table::release (T);
return 0;
}
static int table::font(
Table T,
int left,
int top,
int right,
int bottom,
char* font_name,
char* face=0,
float siz =-1.0,
int start_pos =0,
int len =-1)
Font use in table fields. In addition the font face and size can be set.
| Name | Type | Default | Description |
| Return | int | 0 or ErrorCode | |
| T | Table | - | Table used |
| left | int | - | first Column (0-based) |
| top | int | - | first Row (0-based) |
| right | int | - | >= 0 : first column, which is not to be edited any further (0-based) -1 : All further columns of the table |
| bottom | int | - | >= 0 : first row, which is not to be edited any further (0-based) -1 : All further rows of the table |
| font_name | String or char* | - | Font name |
| face | String or char* | Regular | Font face, e.g "Bold Italic" |
| siz | float | - | Text size in points |
| start_pos | int | 0 | Text position per cell from which the cell text formatting is to be change |
| len | int | -1 | Length of the text to which the cell text formatting is to be change -1 : To the end of the cell text |
int main ()
{
Table T = table::alloc ();
if (!T) return 0;
if (table::get (T, 0, 0) != 0)
{
table::release (T);
return 0;
}
table::font (T, 0, 0, 2, 2, "Cochin", "Bold Italic", 18.0);
table::release (T);
return 0;
}
static int table::format(
Table T,
int left,
int top,
int right,
int bottom,
char* fmt,
int start_pos =0,
int len=-1,
int rmvOverrides = 1,
char* exceptThese = "")
Set paragraph for table fields
| Name | Type | Default | Description |
| Return | int | 0 or ErrorCode | |
| T | Table | - | Table used |
| left | int | - | first Column (0-based) |
| top | int | - | first Row (0-based) |
| right | int | - | >= 0 : first column, which is not to be edited any further (0-based) -1 : All further columns of the table |
| bottom | int | - | >= 0 : first row, which is not to be edited any further (0-based) -1 : All further rows of the table |
| fmt | String or char* | - | Name of a defined paragraph style |
| start_pos | int | 0 | Text position per cell from which the cell text formatting is to be change |
| len | int | -1 | Length of the text to which the cell text formatting is to be change -1 : To the end of the cell text |
| rmvOverrides | int | 1 | Remove Local overrides like color, superscript, ... ? 1 : Yes 0 : No, keep local overrides |
| exceptThese | String or char* | "" | Do not change these paragraph styles. The specification is only evaluated by comet_pdf! The string can contain multiple paragraph styles, even non-existent ones. Individual style names are separated by blanks. If a style name contains blanks, the name must be enclosed in quotation marks. A valid specification would be e.g.: "aaa \"bbb\" ccc |
int main ()
{
Table T = table::alloc ();
if (!T) return 0;
if (table::get (T, 0, 0) != 0)
{
table::release (T);
return 0;
}
table::format (T, 0, 0, 2, 2, "TTT");
table::release (T);
return 0;
}
static int table::skew(
Table T,
int left,
int top,
int right,
int bottom,
float degrees,
int start_pos =0,
int len =-1)
Skew the script. The skew is measured in degrees measured from the perpendicular. The degree specified must be within the range of -85° - +85°. Negative values produce a text skew to the left. Values over 60° as a rule produce illegible script. This option is generally somewhat questionable.
| Name | Type | Default | Description |
| Return | int | 0 or ErrorCode | |
| T | Table | - | Table used |
| left | int | - | first Column (0-based) |
| top | int | - | first Row (0-based) |
| right | int | - | >= 0 : first column, which is not to be edited any further (0-based) -1 : All further columns of the table |
| bottom | int | - | >= 0 : first row, which is not to be edited any further (0-based) -1 : All further rows of the table |
| degrees | float | - | Skew angle (false italic) of the single letters in the range of -85.0 - +85.0. |
| start_pos | int | 0 | Text position per cell from which the cell text formatting is to be change |
| len | int | -1 | Length of the text to which the cell text formatting is to be change -1 : To the end of the cell text |
int main ()
{
Table T = table::alloc ();
if (!T) return 0;
if (table::get (T, 0, 0) != 0)
{
table::release (T);
return 0;
}
table::skew (T, 0, 0, 2, 2, 30.0);
table::release (T);
return 0;
}
static int (
Table T,
int left,
int top,
int right,
int bottom,
float degrees,
int start_pos =0,
int len =-1)
Using spin it is possible to rotate individual letters within a text. The text will be made illegible but whoever wants it that way ... . The degree numbers are expected in mathematical rotational direction i.e. counter-clockwise.
| Name | Type | Default | Description |
| Return | int | 0 or ErrorCode | |
| T | Table | - | Table used |
| left | int | - | first Column (0-based) |
| top | int | - | first Row (0-based) |
| right | int | - | >= 0 : first column, which is not to be edited any further (0-based) -1 : All further columns of the table |
| bottom | int | - | >= 0 : first row, which is not to be edited any further (0-based) -1 : All further rows of the table |
| degrees | float | - | Rotation of the single letters of the cell text in the range of -85.0 - +85.0. |
| start_pos | int | 0 | Text position per cell from which the cell text formatting is to be change |
| len | int | -1 | Length of the text to which the cell text formatting is to be change -1 : To the end of the cell text |
int main ()
{
Table T = table::alloc ();
if (!T) return 0;
if (table::get (T, 0, 0) != 0)
{
table::release (T);
return 0;
}
table::spin (t, 0, 0, 2, 2, 10.0);
table::release (T);
return 0;
}
static int table::textcolor(
Table T,
int left,
int top,
int right,
int bottom,
char* color_name,
float tint =100.0,
int start_pos =0,
int len=-1)
Set the color of the font and the color of the framing of the font. Transparency may be added to both values.
| Name | Type | Default | Description |
| Return | int | 0 or ErrorCode | |
| T | Table | - | Table used |
| left | int | - | first Column (0-based) |
| top | int | - | first Row (0-based) |
| right | int | - | >= 0 : first column, which is not to be edited any further (0-based) -1 : All further columns of the table |
| bottom | int | - | >= 0 : first row, which is not to be edited any further (0-based) -1 : All further rows of the table |
| ⇨ ;Color definition by named swatch | |||
| color_name | String or char* | - | Name of a color definition from the color field or base color |
| tint | float | 100.0 | Opacity of the color in % (0.0 - 100.0) |
| ⇨ Color definition by RGB values | |||
| red | int | - | Red portion of the color (0-255) |
| green | int | - | Green portion of the color (0-255) |
| blue | int | - | Blue portion of the color (0-255) |
| tint | float | 100.0 | Opacity of the color % (0.0-100.0) |
| ⇨ Further general parameters | |||
| start_pos | int | 0 | Text position per cell from which the cell text formatting is to be change |
| len | int | -1 | Length of the text to which the cell text formatting is to be change -1 : To the end of the cell text |
int main ()
{
Table T = table::alloc ();
if (!T) return 0;
if (table::get (T, 0, 0) != 0)
{
table::release (T);
return 0;
}
table::textcolor_rgb (T,
1, 1, 2, 2,
255, 0, 0, 100.0, "",
0, 8);
table::textstroke_rgb (T,
1, 1, 2, 2,
0, 0, 255, 70.0, "",
0, 8);
table::textcolor_rgb (T,
1, 1, 2, 2,
0, 255, 255, 100.0, "",
9, 5);
table::textstroke_rgb (T,
1, 1, 2, 2,
255, 0, 255, 70.0, "",
9, 5);
table::release (T);
return 0;
}
static int table::textstroke(
Table T,
int left,
int top,
int right,
int bottom,
char* color_name,
float tint=100.0,
int start_pos=0,
int len=-1)
Stroke colöor for the letters of the cell text.
| Name | Type | Default | Description |
| Return | int | 0 or Error code | |
| T | Table | - | Valid table reference |
| left | int | - | first Column (0-based) |
| top | int | - | first Row (0-based) |
| right | int | - | >= 0 : first column, which is not to be edited any further (0-based) -1 : All further columns of the table |
| bottom | int | - | >= 0 : first row, which is not to be edited any further (0-based) -1 : All further rows of the table |
| ⇨ Color definition by named swatch | |||
| color_name | String oder char* | - | Name einer Farbdefinition aus den Farbfeldern oder Standardfarbe |
| tint | float | 100.0 | Deckkraft der Farbe in % (0.0-100.0) |
| ⇨ Color definition by RGB values | |||
| red | int | - | Red component of the color (0-255) |
| green | int | - | Green component of the color (0-255) |
| blue | int | - | Blue component of the color (0-255) |
| tint | float | 100.0 | color tint in percent (0.0 - 100.0). The specification is only used if new_name is not empty. |
| new_name | String oder char* | "" | Name of a new swatch to be created 0 or "" : Do not create a swatch Otherwise : If the swacht does not yet exist, create a swatch field for the given color |
| ⇨ Weitere allgemeine Parameter | |||
| start_pos | int | 0 | Textposition pro Zelle, ab der die Formatierung der Zelltextes geändert werden soll |
| len | int | -1 | Länge des Textes pro Zelle, dessen Formatierung geändert werden soll -1 : Bis zum Ende des Zelltextes |
static int table::align(
Table T,
int left,
int top,
int right,
int bottom,
int alignType,
int last_align,
int startPos = 0,
int len = -1)
Set the text left-justified, right-justified, centered or as center-justified.. For the last row another value can be set in each case : It simply does not look as good if the last row is also center-justified.
| Name | Type | Default | Description |
| Return | int | 0 or ErrorCode | |
| T | Table | - | Table used |
| left | int | - | first Column (0-based) |
| top | int | - | first Row (0-based) |
| right | int | - | >= 0 : first column, which is not to be edited any further (0-based) -1 : All further columns of the table |
| bottom | int | - | >= 0 : first row, which is not to be edited any further (0-based) -1 : All further rows of the table |
| alignType | int | - | Text alignment kLeft : left kCenter : centered kRight : right kJustify : justify |
| last_align | int | - | Alignment of the last text line of paragraphs.
The information is only used in justified text (kJustify)! kLeft kCenter kRight kJustify |
| start_pos | int | 0 | Text position per cell from which the cell text formatting is to be change |
| len | int | -1 | Length of the text to which the cell text formatting is to be change -1 : To the end of the cell text |
int main ()
{
Table T = table::alloc ();
if (!T) return 0;
if (table::get (T, 0, 0) != 0)
{
table::release (T);
return 0;
}
table::skew (T, 0, 0, 2, 2, "TTT");
table::release (T);
return 0;
}
static int table::insertimage(
Table T,
int col,
int row,
char* path,
float w = -1.0,
float h = -1.0,
int align = 5,
float boundingBox = 0.0,
int start = 0,
int len = -1,
int pindex = -2,
int clipToFrame = 0,
int flags = 4,
float tolerance = 0.0,
float minPathSz = 0.0,
float inset = 0.0)
Insert an image into a cell of a table. Existing text can be partially or completely deleted. The image can be scaled. The image will be directly inserted into the document, not as a reference.
static int table::insert_taggedtext(
Table T,
int col,
int row,
char* text,
int start_pos =0,
int len =-1,
int autoload =0)
Insert tagged text into a table cell.
static int table::inserttext(
Table T,
int col,
int row,
char* text,
int start_pos =0,
int len =-1,
int autoload =0)
like cell::insert_taggedtext.
static int table::space_before(Table T, float space)
Set the space before a table.
| Name | Type | Default | Description |
| Return | int | 0 or ErrorCode | |
| T | Table | - | valid table reference |
| space | float | - | space in points (1/72 dpi) |
static int table::space_after(Table T, float space)
Set the space after a table.
| Name | Type | Default | Description |
| Return | int | 0 or ErrorCode | |
| T | Table | - | valid table reference |
| space | float | - | space in points (1/72 dpi) |
static int table::set_id(
Table T,
int id = 0,
int id2 = 0,
int id3 = 0,
char* stringid = 0)
Set the root table record id of a given table
| Name | Type | Default | Description |
| Return | int | 0 or ErrorCode | |
| T | Table | - | valid table reference |
| ⇨ Object id | |||
| id | int | 0 | RootTableRecordID |
| id2 | int | 0 | RootTableRecordID2 |
| id3 | int | 0 | RootTableRecordID3 |
| stringid | String or char* | 0 | RootTableRecordStringID |
static int table::setid(
Table T,
int id = 0,
int id2 = 0,
int id3 = 0,
char* stringid = 0)
Set the root table record id of a given table (like set_id).
| Name | Type | Default | Description |
| Return | int | 0 or ErrorCode | |
| T | Table | - | valid table reference |
| ⇨ Object id | |||
| id | int | 0 | RootTableRecordID |
| id2 | int | 0 | RootTableRecordID2 |
| id3 | int | 0 | RootTableRecordID3 |
| stringid | String or char* | 0 | RootTableRecordStringID |
static int table::get_id(
Table T,
int* id = 0,
int* id2 = 0,
int* id3 = 0,
char* stringid = 0)
Get the root table record id of a given table.
| Name | Type | Default | Description |
| Return | int | -1 : error otherwise : ID1 of RoottableRecordId of table |
|
| T | Table | - | valid table reference |
| ⇨ ID des Objektes, mit dem die Tabelle verknüpft werden soll : | |||
| id | int* | 0 | return variable for RootTableRecordID 0 : ignore |
| id2 | int* | 0 | return variable for RootTableRecordID2 0 : ignore |
| id3 | int* | 0 | return variable for RootTableRecordID3 0 : ignore |
| stringid | String or char* | 0 | return variable for RootTableRecordStringID 0 : ignore otherwise : allocated string for the result |
static int table::getid(
Table T,
int* id = 0,
int* id2 = 0,
int* id3 = 0,
char* stringid = 0)
Get the root table record id of a given table (like get_id).
| Name | Type | Default | Description |
| Return | int | -1 : error otherwise : ID1 of RoottableRecordId of table |
|
| T | Table | - | valid table reference |
| ⇨ ID des Objektes, mit dem die Tabelle verknüpft werden soll : | |||
| id | int* | 0 | return variable for RootTableRecordID 0 : ignore |
| id2 | int* | 0 | return variable for RootTableRecordID2 0 : ignore |
| id3 | int* | 0 | return variable for RootTableRecordID3 0 : ignore |
| stringid | String or char* | 0 | return variable for RootTableRecordStringID 0 : ignore otherwise : allocated string for the result |
static int table::get_templateid(Table T)
Get the id of the original table template of the table. The value is only defined in tables inserted by table placeholders using v3.3 or later.
| Name | Type | Default | Description |
| Return | int | ID of original table template | |
| T | Table | - | Zieltabelle |
static int table::set_templateid(Table T, int id)
Set the "original" table template of a table.
| Name | Type | Default | Description |
| Return | int | 0 or ErrorCode | |
| T | Table | - | valid table reference |
| id | int | - | new ID |
static int table::get_placeholderid(Table T)
Get the id of the table placeholder that inserted the table into the document.
| Name | Type | Default | Description |
| Return | int | ID of table placeholder | |
| T | Table | - | valid table reference |
static int table::set_placeholderid(Table T, int id)
Set the "original" placeholder id of a table.
| Name | Type | Default | Description |
| Return | int | 0 or ErrorCode | |
| T | Table | - | valid table reference |
| id | int | - | new ID |
static int table::build(
Table T,
int row = -1,
int col = -1,
int execActionsOnly = -1)
Build a table using its table module settings. Function is like clicking then
apply button
of panel Table module.
| Name | Type | Default | Description |
| Return | int | 0 or ErrorCode | |
| T | Table | - | valid table reference |
| ⇨ Restrict building to a special table cell | |||
| row | int | -1 | 0-based row number of the cell -1 : complete table |
| col | int | -1 | 0-based column number Ignored if row=-1 |
| execActionsOnly | int | -1 | Do apply the tables shape methods only? -1 : No, build table/cell (and execute shape methods after building) kPreAction : Only apply the pre-methods of the given cell kPostAction : Only apply the post-methods of the given cell kPreActionTable : Only the apply the pre-methods of the table, row and col are ignored in this case. kPostActionTable : Only the apply the post-methods of the table, row and col are ignored in this case. |
Build the third table of the current text model.
#include "internal/text.h" #include "internal/table.h"
int main () { Table T = table::alloc (); int result;
result = table::get (T, 0, 3); if (result) { showmessage ("%s", serror (result)); return 0; }
table::build (T); table::release (T);
return 0; }
static int table::reset(
Table T,
int row = -1,
int col = -1)
Delete all rows and columns created by a table module built. The function is identical with
the button
of panel Table Composition
and the menu commands
Menübefehlen
Plug-Ins -> Table Composition -> Clean Table
Plug-Ins -> Tabellenaufbau -> Remove Rows and Columns of Selected Cell
Clean Table of panel Table Composition
Remove Rows and Columns of Selected Cell of panel Table Composition
| Name | Type | Default | Description |
| Return | int | 0 or ErrorCode | |
| T | Table | - | valid table reference |
| ⇨ Restrict rebuilding to a special table cell | |||
| row | int | -1 | 0-based row number of the cell -1 : complete table |
| col | int | -1 | 0-based column number Ignored if row=-1 |
Reset the third table of the current text model.
#include "internal/text.h" #include "internal/table.h"
int main () { Table T = table::alloc (); int result;
result = table::get (T, 0, 3); if (result) { showmessage ("%s", serror (result)); return 0; }
table::reset (T); table::release (T);
return 0; }
static Table table::get_parent(Table T)
Refers to the automatic built table, that builts *me*. The reference isn't valid for all other tables. Check the returned value using table::is_valid. You don't have to alloc the result, but if you you want use the result later in the script, copy its content to an allocated Table ref using item::copy.
| Name | Type | Default | Description |
| Return | Table | Reference to the table that built T, check using table::is_vaild. | |
| Table | T | - | valid table |
static int table::has_parent(Table T)
Short cut for table::is_valid (table::get_parent (T));
| Name | Type | Default | Description |
| Return | int | 0 : T has no parent table 1 : T was built by an automatic buit table |
|
| Table | T | - | valid table |
static int table::broaden_to_frame(
Table T,
int col,
int columnAware = 0,
List cols = 0)
Fit table to the with of the textframe by changing the width of a given/all column(s).
Since v3.3 R2892, 08.05.2012 Sub tables are fitted to their containing cell instead of the text frame.
| Name | Type | Default | Description |
| Return | int | 0 or ErrorCode | |
| T | Table | - | Destination table |
| col | int | - | 0 - based number of column to change -1 : change all columns relative to their old width ratios -2 : distribute width evenly across all columns When shrinking the table, a minimum column width of 3.0pt is enforced! The resulting table may never fit the frame! |
| columnAware | int | 0 | Use column width in multi column texts? 0 : No 1 : Yes |
| cols | List | 0 | List of 0-based column numbers. If the list is not empty and the parameter col is < 0, only the columns specified in the list will be changed. All other columns keep their current width. The width change of the specified columns is done according to the specification in col relative to the old width (-1) or uniformly (-2). |
int main ()
{
Table T = table::alloc ();
table::get (T, 0, 0);
table::broaden_to_frame (T, 1);
return 0;
}
static int table::equal_cols(
Table T,
int col = -1,
...)
Fit all given rows to the same width. Table width is untouched.
| Name | Type | Default | Description |
| Return | int | 0 or ErrorCode | |
| T | Table | - | Destination table |
| col | int | -1 | First column. If missing or -1, all columns are fitted |
| ... | int | Optional more columns -1 : all columns until the last |
Bring all columns of a table to the same width
int main ()
{
Table T = table::alloc ();
table::get (T, 0, 0);
table::equal_cols (T);
return 0;
}
Bring all except the first and second columns of a table to the same width. If -1 is missing, the function call has no effect.
int main ()
{
Table T = table::alloc ();
table::get (T, 0, 0);
table::equal_cols (T, 2, -1);
return 0;
}
static int table::equal_cols_by_list(Table T, List cols = 0)
Fit all given rows to the same width. Table width is untouched. Function works exactly like equal_cols but the columns are given as a list.
| Name | Type | Default | Description |
| Return | int | 0 or ErrorCode | |
| T | Table | - | Destination table |
| cols | List | 0 | List of (0-based) columns to change. If empty, all columns are changed. |
Broaden a selected table to the frame with by changing the selected columns.
int main ()
{
Table T = table::alloc ();
ItemRef frame = item::alloc();
List cols = list::alloc ();
int start, len, l, t, r, b, i;
textmodel::selection (&start, &len, frame, 0, T, &l, &t, &r, &b);
if (!table::is_valid (T)) return 0;
for (i = l; i < r; i++) list::insert (cols, i);
table::broaden_to_frame (T, l);
table::equal_cols_by_list (T, cols);
return 0;
}
static int table::fit_col(
Table T,
int col,
int canShrink = 0,
int keepLineHeights = 0,
float precision = 0.1,
float maxWidth = 1000.0,
int emergencyExit = 30)
Fit columns to have no text overset in any of its cells. If there is no text overset, you can shrink the column width to its optimum. The function only works on tables not lying in the textmodels overset. Applying the function on tables lying in the overset will cause the function to return the error code 1259.
ATTENTION : If the table contains merged cells, the resulting column withs may append from the order of the calls to fit_col!
Caused by the slight differences between the text lengths in InDesign® and comet_pdf the resulting column widths may differ a little bit too.
| Name | Type | Default | Description |
| Return | int | 0 or ErrorCode | |
| T | Table | - | Destination table |
| col | int | - | Destination column (0-based) |
| canShrink | int | 0 | shrinking columns allowed? 0 : not allowed, only broaden 1 : shrink columns larger than its content |
| keepLineHeights | int | 0 | Take care on line heights while shrinking column? (only active if canShrink = 1) 0 : Cells can become higher 1 : Keep cell heights while shrinking Cells with more than one paragraph may need a heigher row too to avoid oversets. in this case the function will return the error 1277 (cannotRemoveOversetErr). Parameter is ignored by comet_pdf. |
| precision | float | 0.1 | Precision to fit. Notice that smaller values will increase the calculation time by factor 2 for every power of 10. <0.001 Use the old method (v3.3 R3636) to fit the column. maxWidth and emergencyExit are ignored in this case. Comet_pdf uses the default 0.1 automatically if the value is smaller than 0.001. |
| maxWidth | float | 1000.0 | Maximum width of the column. The value is only used for columns having an overset in at least one cell. Notice that values near the resulting width can speed up the function dramatically. If the maximum is reached but the cell has still an overset, the error 1278 (maxWidthTooSmallErr) is returned. |
| emergencyExit | int | 30 | Number of tries. For some unexpected cases of fire, nuclear rays or so, use the emergency exit. The function will return 1279 (emergencyExitErr) in this case.. |
Passe die dritte der Spalte der Tabelle an.
int main ()
{
Table T = table::alloc ();
table::get (T, 0, 0);
table::fit_col (T, 2, 1);
return 0;
}
static int table::apply_style(
Table T,
char* styleName,
int removeTableOverrides = 0,
int removeCellStyle = 0)
Apply a table style to a given table. With an empty style you can remove the current table style. Table styles are invoked with InDesign® CS3. Under InDesign® versions prior to CS3 the function does nothing but returns with an error
| Name | Type | Default | Description |
| T | Table | - | Valid table reference |
| whichStyle | String or char* | - | The style to apply. If the style is part of a style hierarchy, use the complete ':' delimited path here! "" : remove the current style |
| removeTableOverrides | int | 0 | Local table overrides should be removed (1) or not (0)
Ignored by Illustrator. |
| removeCellStyle | int | 0 | Flag for removing all cell style informatting from the table
Ignored by Illustrator. |
static char* table::get_style(Table T)
Find the style path and name of a given table. In case of some errors or in case of using InDesign® version prior CS3 the function returns "".
| Name | Type | Default | Description |
| Return | char* | Path and name of table style. ':' is used as path delimiter. "" : No style set or error or InDesign version prior CS3 The return value is read only, do NOT CHANGE. The result will be overridden on following calls to the function. See here to learn more about functions returning r/o char* values. |
|
| T | Table | - | valid table reference |
strcpy (cname, table::get_style (T));
static int table::apply_cellstyle(
Table T,
char* styleName,
int l,
int t,
int r,
int b,
int removeOverrides = 0,
int applyParaStyle = 0)
Apply a cell style to a given cell range. With an empty style you can remove current cell styles from the given cell range. Cell styles are invoked with InDesign® CS3. Under InDesign® versions prior to CS3 the function does nothing but returns with an error
static int table::clear_celloverrides(
Table T,
char* styleName,
int l,
int t,
int r,
int b,
int depth = 2,
int keepTableModuleData = 0,
int refreshPanel = 0)
Clear all cell overrides from the given area that conflict with the applied cell style. The function is identical to table::cell::clear_overrides.
static int table::clear_overrides(
Table T,
int clearCellStyles = 0,
int keepTableModuleData = 0,
int refreshPanel = 0)
Clears any local table style overrides on the given table.
| Name | Type | Default | Description |
| Return | int | 0 or ErrorCode | |
| T | Table | - | Valid table reference |
| clearCellStyles | int | 0 | 0 : Keep local cell styles 1 : Clear all local cell styles |
| keepTableModuleData | int | 0 | Which data of the Table Composition should be kept? kKeepAll : Keep all Table Composition data kKeepGroupsAndInfo : Keep groups and info1/2 only kKeepGroups : Keep groups only kKeepInfo : Keep info1/2 only kKeepNothing : Remove all Table Composition data |
| refreshPanel | int | 0 | Update the panel Table Composition at the end? 0 : No, faster 1 : If the panel shows a cell of the current table, it is updated after the change. |
static int table::compress_colwise(
Table T,
int firstCol = 0,
int colSpan = 1,
int flattenLastChunk = 0,
int copyColHeader = 0,
int fit_columns = 1,
float delimRowHeight = 0.0)
Compress a large table to fit into its text frame. Compression will by done by fitting columns and by moving designates columns to new table rows. You can compress tables as often as you want. If the textframe is smaller than the first columns or smaller than the first columns and the first colSpan columns, the table is compressed to have exactly firstCol+colSpan columns. The function will return the error code wrongColumnsForCompressErr (1266) in this case.
Empty rows at the end of the table are removed after compressing the table.
The function only works on tables not lying in the textmodels overset. Applying the function on tables lying in the overset will cause the function to return the error code 1259.
Beginning at column firstCol all table columns are fitted to their smallest size. After this, all columns exceeding the text frame, are moved to (new) rows at the end of the table. The function tries to fill new rows completelly. Even if a row is filled completelly, new rows are created. Only body cells are moved.
With colSpan you can handle a number of columns as to be one unit. Units will never be broken onto different table rows.
If the current line is filled and the last unit will not fill all columns of a new line, but (oho!) the last line would be long enough, copy them to this line.
With copyColHeader = 1 you force copying the content of leading cells to the new table rows.
As a last step, all columns from firstCol will be fitted again. This step is needed, because the content of moved cells can be longer than the destination column. As a result of this, the table can get larger than the text frame again. A second call to compress_colwise may be sensefull. But this call will destroy the inner table informatting needed for calls to get_keystring. For this problem, we have no solution now. If there is place inside the text frame, and finalBroaden is set this space is given to each column from firstCol equally.| Name | Type | Default | Description |
| Return | int | 0 or ErrorCode | |
| T | Table | - | Valid table reference |
| firstCol | int | 0 | Start reconstruction at this column |
| colSpan | int | 1 | How many columns each form a block that must not be separated by table rows? |
| flattenLastChunk | int | 0 | If necessary and if possible, the cells of the last columns are not moved under each other, but next to each other in one row. |
| copyColHeader | int | 0 | Transfer contents of the "guide cells" to the new lines? |
| fit_columns | int | kBroadenFirstLast | kBroadenFirstLast Shrink columns to their minimum before rebuilding table, broaden columns to fit the text frame after rebuilding kBroadenFirst Shrink columns to their minimum before rebuilding table kBroadenLast Broaden columns to fit the text frame after rebuilding kBroadenNever Leave the column widths untouched |
| delimRowHeight | float | 0.0 | Create a transparent delimiter row of the given height 0.0 : no delimiting row < 0.0 : Use current row height |
static int table::decompress_colwise(Table T)
Undo a table compression made by compress_colwise or woodoo. Changed column widths between the compress and now are overridden.
| Name | Type | Default | Description |
| Return | int | 0 or ErrorCode | |
| T | Table | - | Valid table reference |
static int table::woodoo(Table T, int adjustToFrame = 1)
Reorder a 4 column table to make it as small as possible and still fit into the surrounding frame, see the following images:
Before 
After 
Just Woodoo. The counterspell is called oodoow, which returns the table to its original state. There are some restrictions :
To make things easier, the general counterspell decompress_colwise can also be used as an antidote. And vice versa, oodoow() also returns tables packed with compress_colwise to their original state.
| Name | Type | Default | Description |
| Return | int | 0 OR ErrorCode | |
| T | Table | - | Valid table reference |
| adjustToFrame | int | 1 | Adjust table to frame at the end? 0 : No 1 : Yes. The first and third columns of the table are widened so that the right outer edge of the frame exactly matches the right boundary line of the table. (Frame width, type and color must be defined in the cell styles of the cells!) For tables that remain wider than the frame, the parameter has no effect. |
static int table::oodoow(Table T)
Tables that have been compressed with woodoo are restored to their original state. Manual changes of column widths and cell styles between woodoo and oodoow are overwritten.
static int table::break_(
Table T,
int headerRows = 0,
int repeatHeaderRows = 1,
int headerColumns = 0,
int repeatHeaderColumns = 1,
int justifyRows = 0,
float delimiterHeight = 0.0,
int copyCellProperties = 1,
int flags = 0)
Wrap a table to match its frame width. Columns outside the textframe are moved into new rows at the end of the table.
The new rows of the table may enlarging column widths. If, say the 10th column is moved into column 1 of a new row, column 1
will get the maximum of the column widths 2 and 10. :

With justifyRows you can control the number of columns of rows, see the following screeshots:
Vorher

justifyRows = 0

justifyRows = 1

| Name | Type | Default | Description |
| Return | int | 0 or ErrorCode 1266 : The headers columns are outside the frame already |
|
| T | Table | - | Valid table reference |
| headerRows | int | 0 | Number of header rows |
| repeatHeaderRows | int | 1 | Repeat header rows? 0 : do not repeat 1 : repeat |
| headerColumns | int | 0 | Number of header columns |
| repeatHeaderColumns | int | 1 | Repeat header columns? 0 : do not repeat 1 : repeat |
| justifyRows | int | 0 | Try to get uniform rows (see below)? 0 : no 1 : yes |
| delimiterHeight | float | 0.0 | If > 0.0, a transparent delimiter row is inserted between every block of new rows. |
| copyCellProperties | int | 1 | Copy cell properties? 0 : no 1 : yes Following properties (in this sequence) are copied :
|
| flags | int | 0 | Additional options 0 : Nothing 1 : Leave column widths unchanged in case of errors |
int main ()
{
Table T = table::alloc ();
table::get (T, gFrame, 0);
table::break_ (T, 1, 1, 1, 1, 1, 12.3, 1);
return 0;
}
As an alternative to table::break:, you can also divide the table into smaller tables so that each small table fits into the current frame. However, this approach is not reorganization-proof.
// @@ICONID 626
// Check whether all columns are narrower than the frame width // int first_check (Table T, float w) { float wcol; int c;
for (c = 0; c < table::columns (T); c++) { wcol = table::get_col_width (T, c); if (wcol > w) { return c; } }
return -1; }
// Find the first column that extends beyond the right edge of the frame // int find_first_outer (Table T, float w) { float wcols; int c = 1;
while (1) { wcols = table::get_col_width (T, 0, c); if (wcols > w) return c - 1; ++c; if (c > table::columns (T)) return -1; } }
// Create a copy of a table and insert it directly behind the table. // int duplicate_table (ItemRef frame, Table T) { int len; int pos = table::get_anchorpos (T, &len); Scrap data = 0; String str1, str2;
if (system::version () == -1) { // comet_pdf str1 = string::alloc (); str2 = string::alloc ();
frame::gettext (frame, str1, pos, len, kExportW2); string::set (str2, "%%!TT%s", str1); frame::insert (frame, str2, pos+len, 0);
string::release (str1); string::release (str2); } else { data = textmodel::copy (frame, pos, len); textmodel::paste (frame, data, pos+len); }
return 0; }
// Main // int main () { Table T = table::alloc (); int tableIndex = 0; int c, first_out; float w, h;
// Is there even a table? // table::get (T, gFrame, tableIndex); if (!table::is_valid (T)) return 0;
// Determine frame size // frame::get_size (gFrame, &w, &h);
// Make sure that every column fit INDIVIDUALLY into the frame // c = first_check (T, w); if (c >= 0) { showmessage ("The table cannot be divided. At least column %d of the table is wider than the frame.", c+1); return 0; }
// Divide the table into smaller tables so that // each individual table fits into the frame. // while (1) { first_out = find_first_outer (T, w); if (first_out < 0) break; duplicate_table (gFrame, T); table::remove_cols (T, first_out, -1); ++tableIndex; table::get (T, gFrame, tableIndex); table::remove_cols (T, 0, first_out); }
return 0; }
static int table::unbreak_(Table T, int resetCellProperties = 1)
Uncompress table.
| Name | Type | Default | Description |
| Return | int | 0 or ErrorCode | |
| T | Table | - | Valid table reference |
| copyCellProperties | int | 1 | Reset cell properties? 0 : no 1 : yes Following properties (in this sequence) are copied :
|
static int table::get_firstouter_column(Table T)
Find the number of the first column that is not completely inside the text frame.
| Name | Type | Default | Description |
| Return | int | 0-based number of the first column not completely inside the text frame -1 :All columns inside the text frame -2 : Error |
|
| T | Table | - | Gültige Tabellenreferenz |
static char* table::get_keystring(Table T, int infoType = 1)
Build a table key. The key is independent on tables re-structured by compress_colwise or woodoo.
| Name | Type | Default | Description |
| Return | char* | Key string.
The return value is read only, do NOT CHANGE. The result will be overridden on following calls to the function. See here to learn more about functions returning r/o char* values. |
|
| T | Table | - | Valid table reference |
| infotype | int | 1 | type of informatting used in the key 0 : row column ... 1 : PlaceholderID ID ID2 ... 2 : PlaceholderID ID ID2 ID3 ... 3 : PlaceholderID ID ID2 ID3 "StringID" ... 4 : "cell content" ... |
static int table::get_keep_with_next_row(Table T, int row)
Keep a table row together with its successor or not?
| Name | Type | Default | Description |
| Return | int | 1 : keep them together 0 : rows dividable |
|
| T | Table | - | Valid table reference |
| row | int | - | row number (0-based) |
int main ()
{
Table T = table::alloc ();
int keep;
int result;
table::get (T, 0, 0);
keep = table::get_keep_with_next_row (T, 11);
wlog ("", "old keep together = %d\n", keep);
if (keep) keep = 0;
else keep = 1;
result = table::set_keep_with_next_row (T, 11, keep);
wlog ("", "change keep together = %d\n", result);
keep = table::get_keep_with_next_row (T, 11);
wlog ("", "new keep together = %d\n", keep);
return 0;
}
static int table::set_keep_with_next_row(
Table T,
int row,
int newState)
Keep a table row together with its successor or not.
| Name | Type | Default | Description |
| Return | int | 0 or ErrorCode | |
| Return | int | 1 : keep them together 0 : rows dividable |
|
| T | Table | - | Valid table reference |
| row | int | - | row number (0-based) |
int main ()
{
Table T = table::alloc ();
int keep;
int result;
table::get (T, 0, 0);
keep = table::get_keep_with_next_row (T, 11);
wlog ("", "old keep together = %d\n", keep);
if (keep) keep = 0;
else keep = 1;
result = table::set_keep_with_next_row (T, 11, keep);
wlog ("", "change keep together = %d\n", result);
keep = table::get_keep_with_next_row (T, 11);
wlog ("", "new keep together = %d\n", keep);
return 0;
}
static int table::get_row_start(Table T, int row)
Where does the next table row appear, if a table break is necessary at this row?
| Name | Type | Default | Description |
| Return | int | eStartAnywhere eStartNextColumn eStartNextFrame eStartNextPage eStartNextOddPage eStartNextEvenPage Please note that comet_pdf only supports eStartAnywhere, eStartNextColumn and eStartNextFrame for now. |
|
| T | Table | - | Valid table reference |
| row | int | - | row number (0-based) |
#include "internal/table.h"
int main () { Table T = table::alloc (); int start; int result;
table::get (T, 0, 0);
start = table::get_row_start (T, 11); wlog ("", "old row start = %d\n", start);
if (start == eStartAnywhere) start = eStartNextColumn; else if (start == eStartNextColumn) start = eStartNextFrame; else if (start == eStartNextFrame) start = eStartNextPage; else if (start == eStartNextPage) start = eStartAnywhere;
result = table::set_row_start (T, 11, start); wlog ("", "change row start = %d\n", result);
start = table::get_row_start (T, 11); wlog ("", "new row start = %d\n", start);
return 0; }
static int table::set_row_start(
Table T,
int row,
int newStart)
Where should the next table row appear, if a table break is necessary at this row?
| Name | Type | Default | Description |
| Return | int | 0 or ErrorCode | |
| T | Table | - | Valid table reference |
| row | int | - | row number (0-based) |
| newStart | int | - | eStartAnywhere eStartNextColumn eStartNextFrame eStartNextPage eStartNextOddPage eStartNextEvenPage Please note that comet_pdf only supports eStartAnywhere, eStartNextColumn and eStartNextFrame for now. |
#include "internal/table.h"
int main () { Table T = table::alloc (); int start; int result;
table::get (T, 0, 0);
start = table::get_row_start (T, 11); wlog ("", "old row start = %d\n", start);
if (start == eStartAnywhere) start = eStartNextColumn; else if (start == eStartNextColumn) start = eStartNextFrame; else if (start == eStartNextFrame) start = eStartNextPage; else if (start == eStartNextPage) start = eStartAnywhere;
result = table::set_row_start (T, 11, start); wlog ("", "change row start = %d\n", result);
start = table::get_row_start (T, 11); wlog ("", "new row start = %d\n", start);
return 0; }
static int table::get_headers_start(Table T)
Where does the table show its header rows?
Using comet_pdf the function does nothing!
| Name | Type | Default | Description |
| Return | int | Where to show the header rows? eStartEachTextColumn eStartEachTextFrame eStartEachPage |
|
| T | Table | - | Valid table reference |
#include "internal/table.h"
int main () { Table T = table::alloc (); int s1, sn; int result;
table::get (T, 0, 0);
// Before s1 = table::get_headers_start (T); wlog ("", "headers start = %d\n", s1);
sn = table::get_footers_start (T); wlog ("", "footers start = %d\n", sn);
// Change if (s1 == eStartEachTextColumn) s1 = eStartEachTextFrame; else if (s1 == eStartEachTextFrame) s1 = eStartEachPage; else if (s1 == eStartEachPage) s1 = eStartEachTextColumn;
if (sn == eStartEachTextColumn) sn = eStartEachTextFrame; else if (sn == eStartEachTextFrame) sn = eStartEachPage; else if (sn == eStartEachPage) sn = eStartEachTextColumn;
result = table::set_headers_start (T, s1); result = table::set_footers_start (T, sn);
// After s1 = table::get_headers_start (T); wlog ("", "headers start changed = %d\n", s1);
sn = table::get_footers_start (T); wlog ("", "footers start changed = %d\n", sn);
return 0; }
static int table::get_footers_start(Table T)
Where does the table show its footer rows?
Using comet_pdf the function does nothing!
| Name | Type | Default | Description |
| Return | int | Where to show the header rows? eStartEachTextColumn eStartEachTextFrame eStartEachPage |
|
| T | Table | - | Valid table reference |
#include "internal/table.h"
int main () { Table T = table::alloc (); int s1, sn; int result;
table::get (T, 0, 0);
// Before s1 = table::get_headers_start (T); wlog ("", "headers start = %d\n", s1);
sn = table::get_footers_start (T); wlog ("", "footers start = %d\n", sn);
// Change if (s1 == eStartEachTextColumn) s1 = eStartEachTextFrame; else if (s1 == eStartEachTextFrame) s1 = eStartEachPage; else if (s1 == eStartEachPage) s1 = eStartEachTextColumn;
if (sn == eStartEachTextColumn) sn = eStartEachTextFrame; else if (sn == eStartEachTextFrame) sn = eStartEachPage; else if (sn == eStartEachPage) sn = eStartEachTextColumn;
result = table::set_headers_start (T, s1); result = table::set_footers_start (T, sn);
// After s1 = table::get_headers_start (T); wlog ("", "headers start changed = %d\n", s1);
sn = table::get_footers_start (T); wlog ("", "footers start changed = %d\n", sn);
return 0; }
static int table::set_headers_start(Table T, int newStart)
Where shall the table show its header rows?
Using comet_pdf the function does nothing!
| Name | Type | Default | Description |
| Return | int | 0 or error ccode | |
| T | Table | - | Valid table reference |
| newStart | int | - | eStartEachTextColumn eStartEachTextFrame eStartEachPage |
#include "internal/table.h"
int main () { Table T = table::alloc (); int s1, sn; int result;
table::get (T, 0, 0);
// Before s1 = table::get_headers_start (T); wlog ("", "headers start = %d\n", s1);
sn = table::get_footers_start (T); wlog ("", "footers start = %d\n", sn);
// Change if (s1 == eStartEachTextColumn) s1 = eStartEachTextFrame; else if (s1 == eStartEachTextFrame) s1 = eStartEachPage; else if (s1 == eStartEachPage) s1 = eStartEachTextColumn;
if (sn == eStartEachTextColumn) sn = eStartEachTextFrame; else if (sn == eStartEachTextFrame) sn = eStartEachPage; else if (sn == eStartEachPage) sn = eStartEachTextColumn;
result = table::set_headers_start (T, s1); result = table::set_footers_start (T, sn);
// After s1 = table::get_headers_start (T); wlog ("", "headers start changed = %d\n", s1);
sn = table::get_footers_start (T); wlog ("", "footers start changed = %d\n", sn);
return 0; }
static int table::set_footers_start(Table T, int newStart)
Where shall the table show its footer rows?
Using comet_pdf the function does nothing!
| Name | Type | Default | Description |
| Return | int | 0 or error ccode | |
| T | Table | - | Valid table reference |
| newStart | int | - | eStartEachTextColumn eStartEachTextFrame eStartEachPage |
#include "internal/table.h"
int main () { Table T = table::alloc (); int s1, sn; int result;
table::get (T, 0, 0);
// Before s1 = table::get_headers_start (T); wlog ("", "headers start = %d\n", s1);
sn = table::get_footers_start (T); wlog ("", "footers start = %d\n", sn);
// Change if (s1 == eStartEachTextColumn) s1 = eStartEachTextFrame; else if (s1 == eStartEachTextFrame) s1 = eStartEachPage; else if (s1 == eStartEachPage) s1 = eStartEachTextColumn;
if (sn == eStartEachTextColumn) sn = eStartEachTextFrame; else if (sn == eStartEachTextFrame) sn = eStartEachPage; else if (sn == eStartEachPage) sn = eStartEachTextColumn;
result = table::set_headers_start (T, s1); result = table::set_footers_start (T, sn);
// After s1 = table::get_headers_start (T); wlog ("", "headers start changed = %d\n", s1);
sn = table::get_footers_start (T); wlog ("", "footers start changed = %d\n", sn);
return 0; }
static int table::get_skip_first_header(Table T)
Does the table skip its header rows at the tables start?
Using comet_pdf the function does nothing!
| Name | Type | Default | Description |
| Return | int | Skip header rows at table start? 0 : Show header rows 1 : Skip header rows |
|
| T | Table | - | Valid table reference |
int main ()
{
Table T = table::alloc ();
int skip1, skipN;
int result;
table::get (T, 0, 0);
// Before
skip1 = table::get_skip_first_header (T);
wlog ("", "skip first = %d\n", skip1);
skipN = table::get_skip_last_footer (T);
wlog ("", "skip last = %d\n", skipN);
// Change
if (skip1) skip1 = 0;
else skip1 = 1;
if (skipN) skipN = 0;
else skipN = 1;
result = table::set_skip_first_header (T, skip1);
result = table::set_skip_last_footer (T, skipN);
// After
skip1 = table::get_skip_first_header (T);
wlog ("", "skip first changed = %d\n", skip1);
skipN = table::get_skip_last_footer (T);
wlog ("", "skip last changed = %d\n", skipN);
return 0;
}
static int table::get_skip_last_footer(Table T)
Does the table skip its footer rows at the tables end?
Using comet_pdf the function does nothing!
| Name | Type | Default | Description |
| Return | int | Skip footer rows at table start? 0 : Show footer rows 1 : Skip footer rows |
|
| T | Table | - | Valid table reference |
int main ()
{
Table T = table::alloc ();
int skip1, skipN;
int result;
table::get (T, 0, 0);
// Before
skip1 = table::get_skip_first_header (T);
wlog ("", "skip first = %d\n", skip1);
skipN = table::get_skip_last_footer (T);
wlog ("", "skip last = %d\n", skipN);
// Change
if (skip1) skip1 = 0;
else skip1 = 1;
if (skipN) skipN = 0;
else skipN = 1;
result = table::set_skip_first_header (T, skip1);
result = table::set_skip_last_footer (T, skipN);
// After
skip1 = table::get_skip_first_header (T);
wlog ("", "skip first changed = %d\n", skip1);
skipN = table::get_skip_last_footer (T);
wlog ("", "skip last changed = %d\n", skipN);
return 0;
}
static int table::set_skip_first_header(Table T, int doSkip)
Table shall skip its header rows at tables start.
Using comet_pdf the function does nothing!
| Name | Type | Default | Description |
| Return | int | 0 or error ccode | |
| T | Table | - | Valid table reference |
| doSkip | int | - | 0 : Show header rows at tables start 1 : Skip header rows at tables start |
int main ()
{
Table T = table::alloc ();
int skip1, skipN;
int result;
table::get (T, 0, 0);
// Before
skip1 = table::get_skip_first_header (T);
wlog ("", "skip first = %d\n", skip1);
skipN = table::get_skip_last_footer (T);
wlog ("", "skip last = %d\n", skipN);
// Change
if (skip1) skip1 = 0;
else skip1 = 1;
if (skipN) skipN = 0;
else skipN = 1;
result = table::set_skip_first_header (T, skip1);
result = table::set_skip_last_footer (T, skipN);
// After
skip1 = table::get_skip_first_header (T);
wlog ("", "skip first changed = %d\n", skip1);
skipN = table::get_skip_last_footer (T);
wlog ("", "skip last changed = %d\n", skipN);
return 0;
}
static int table::set_skip_last_footer(Table T, int doSkip)
Table shall skip its footer rows at tables end.
Using comet_pdf the function does nothing!
| Name | Type | Default | Description |
| Return | int | 0 or error ccode | |
| T | Table | - | Valid table reference |
| doSkip | int | - | 0 : Show footer rows at tables end 1 : Skip footer rows at tables end |
int main ()
{
Table T = table::alloc ();
int skip1, skipN;
int result;
table::get (T, 0, 0);
// Before
skip1 = table::get_skip_first_header (T);
wlog ("", "skip first = %d\n", skip1);
skipN = table::get_skip_last_footer (T);
wlog ("", "skip last = %d\n", skipN);
// Change
if (skip1) skip1 = 0;
else skip1 = 1;
if (skipN) skipN = 0;
else skipN = 1;
result = table::set_skip_first_header (T, skip1);
result = table::set_skip_last_footer (T, skipN);
// After
skip1 = table::get_skip_first_header (T);
wlog ("", "skip first changed = %d\n", skip1);
skipN = table::get_skip_last_footer (T);
wlog ("", "skip last changed = %d\n", skipN);
return 0;
}
static char* table::get_cellinfo(
Table T,
int left,
int top,
int which)
Experimentell Get informatting about a table cell set by the Comet table module. Only group membership is implemented now.
| Name | Type | Default | Description |
| Return | char* | On successful return, it contains the requested value (read only!).
The return value is read only, do NOT CHANGE. The result will be overridden on following calls to the function. See here to learn more about functions returning r/o char* values. |
|
| T | Table | - | valid table reference |
| left, top | int | - | 0-based cell index |
| which | int | - | Property? 1 : Group membership, a blank delimited string list of group namens (for example "\""aaa\" \"bbb\"". Qoutes are part of the string!) |
static int table::set_cellinfo(
Table T,
int left,
int top,
char* property,
...)
Experimentell Setting table module infos to a cell
| Name | Type | Default | Description |
| Return | int | 0 or ErrorCode | |
| T | Table | - | valid table reference |
| left | int | - | 0-based index of column |
| top | int | - | 0-based index of row |
| property | String or char* | - | Name of property too change "groups" "rootTableRecordID" - not a cell property but here for completness "columnRecordID" "rowRecordID" "cellRecordID" |
| ⇨ Property "groups" | |||
| listOfGroups | String or char* | "" | Complete list of groups of the cell. The group names are set in quotas and separated by spaces, e.g. "\"Group 1\" \"Group 2\"" "'Group 1' 'Group 2'" A single group name beginning with a letter or a '_' and consisting only of letters, numbers and '_' may also be given without quotas, e.g. "Group_1" |
| refreshPanel | int | 0 | Should the Table Composition panel be updated? 0 : No, faster 1 : If the panel shows a cell of the current table, it is updated after the change. |
| ⇨ properties "rootTableRecordID", "columnRecordID", "rowRecordID", "cellRecordID" | |||
| id | int | 0 | ID1 of table, row/column/cell |
| id2, | int | 0 | ID2 of table, row/column/cell |
| id3 | int, | 0 | ID3 of table, row/column/cell |
| sid | String or char* | "" | StringID of table, row/column/cell |
| refreshPanel | int | 0 | Should the Table Composition panel be updated? 0 : No, faster 1 : If the panel shows a cell of the current table, it is updated after the change. |
static int table::set_info1(
Table T,
char* info,
int refreshPanel = 0)
Set the table informatting Info1.
The values for Info1 and Info2 can also be set directly via the tagged text. Add the following informatting to the TableStart tag:
<TableStart:... <w2Table: Info1='your text' Info2=your text'> ... >
The texts must be correctly coded:
Masking < and > in \<0x00FC\gt; causes, that these strings cannot be used un-translated. They are automatically translated into the corresponding UTF8 character. This is because the location inside the plugins that reads the values from the InDesign input stream, is used by InDesign for TaggedText and IDMS. But with TaggedText, InDesign already gives us ü here, but for IDMS it is still <0x00FC> and we can't see at this point what kind of import it is.
If you use the table module of the plugins in the table, the above-mentioned content for w2Table must also contain all other attributes of the table module with valid values. To do this, export the table once in tagged text and get the full tag from the exported text.
| Name | Type | Default | Description |
| Return | int | 0 or ErrorCode | |
| T | Table | - | valid table reference |
| info | String or char* | - | informatting to set |
| refreshPanel | int | 0 | Should the Table Composition panel be updated? 0 : No, faster 1 : If the panel shows a cell of the current table, it is updated after the change. |
static int table::set_info2(
Table T,
char* info,
int refreshPanel = 0)
Set the table informatting Info2.
The values for Info1 and Info2 can also be set directly via the tagged text. Add the following informatting to the TableStart tag:
<TableStart:... <w2Table: Info1='your text' Info2=your text'> ... >
The texts must be correctly coded:
Masking < and > in \<0x00FC\gt; causes, that these strings cannot be used un-translated. They are automatically translated into the corresponding UTF8 character. This is because the location inside the plugins that reads the values from the InDesign input stream, is used by InDesign for TaggedText and IDMS. But with TaggedText, InDesign already gives us ü here, but for IDMS it is still <0x00FC> and we can't see at this point what kind of import it is.
If you use the table module of the plugins in the table, the above-mentioned content for w2Table must also contain all other attributes of the table module with valid values. To do this, export the table once in tagged text and get the full tag from the exported text.
| Name | Type | Default | Description |
| Return | int | 0 or ErrorCode | |
| T | Table | - | valid table reference |
| info | String or char* | - | informatting to set |
| refreshPanel | int | 0 | Should the Table Composition panel be updated? 0 : No, faster 1 : If the panel shows a cell of the current table, it is updated after the change. |
static char* table::get_info1(Table T)
Get the table informatting Info1.
| Name | Type | Default | Description |
| Return | char* | Info1 of the given table
The return value is read only, do NOT CHANGE. The result will be overridden on following calls to the function. See here to learn more about functions returning r/o char* values. |
|
| T | Table | - | valid table reference |
static char* table::get_info2(Table T)
Get the table informatting Info2.
| Name | Type | Default | Description |
| Return | char* | Info2 of the given table
The return value is read only, do NOT CHANGE. The result will be overridden on following calls to the function. See here to learn more about functions returning r/o char* values. |
|
| T | Table | - | valid table reference |
static int table::get_table_placeholder_id(Table T)
Get the id of the placeholder that built a table. You can not change this value.
| Name | Type | Default | Description |
| Return | int | ID of table placeholder built this table | |
| T | Table | - | valid table reference |
Get the placeholder that built the first table in a text.
int main ()
{
Table t = table::alloc ();
table::get (t, gFrame, 0);
wlog ("", "# Original placeholder of %d: %d ('%s')\n",
item::getint (t),
table::get_table_placeholder_id (t),
table::get_table_placeholder_text (t));
return 0;
}
static char* table::get_table_placeholder_text(Table T)
Get the text content of the placeholder that built a table. You can not change this value.
| Name | Type | Default | Description |
| Return | int | Plain text of the original placeholder The return value is read only, do NOT CHANGE. The result will be overridden on following calls to the function. See here to learn more about functions returning r/o char* values. |
|
| T | Table | - | valid table reference |
Get the placeholder that built the first table in a text.
int main ()
{
Table t = table::alloc ();
table::get (t, gFrame, 0);
wlog ("", "# Original placeholder of %d: %d ('%s')\n",
item::getint (t),
table::get_table_placeholder_id (t),
table::get_table_placeholder_text (t));
return 0;
}
static float table::get_row_height(
Table T,
int startRow,
int count = 1)
Height of table rows. The function returns the height of a contiguous range of table rows.
Using comet_pdf the function returns the row height at creation time or from the last call to resize_rows. This height may differ from the height in the resulting PDF.
| Name | Type | Default | Description |
| Return | float | > 0.0 : Height of row(s) in points (pts) 0.0 : error |
|
| T | Table | - | valid table reference |
| startRow | int | - | First row of requested range (0-based) |
| count | int | 1 | Size of range (how many rows)? |
static float table::get_row_max_height(
Table T,
int startRow,
int count = 1)
Maximum height of table rows. The function returns the maximum height of a contiguous range of table rows.
| Name | Type | Default | Description |
| Return | float | > 0.0 : Maximum height of row(s) in points (pts) 0.0 : error |
|
| T | Table | - | valid table reference |
| startRow | int | - | First row of requested range (0-based) |
| count | int | 1 | Size of range (how many rows)? |
static float table::get_row_min_height(
Table T,
int startRow,
int count = 1)
Minium height of table rows. The function returns the minimum height of a contiguous range of table rows.
| Name | Type | Default | Description |
| Return | float | > 0.0 : Maximum height of row(s) in points (pts) 0.0 : error |
|
| T | Table | - | valid table reference |
| startRow | int | - | First row of requested range (0-based) |
| count | int | 1 | Size of range (how many rows)? |
static float table::get_col_width(
Table T,
int startCol,
int count = 1)
Width of table columns. The function returns the width of a contiguous range of table columns.
| Name | Type | Default | Description |
| Return | float | > 0.0 : Width of column(s) in points (pts) 0.0 : error |
|
| T | Table | - | valid table reference |
| startRow | int | - | First column of requested range (0-based) |
| count | int | 1 | Size of range (how many columns)? |
static int table::cell::set_text(
Table T,
int left,
int top,
char* str,
int insert_pos =0,
int remove_len =-1,
int autoload = 0)
Set the text of a table field.
| Name | Type | Default | Description |
| Return | int | 0 or ErrorCode | |
| T | Table | - | Table used |
| left | int | - | Column (0-based) |
| top | int | - | Row (0-based) |
| str | String or char* | - | Text to be inserted. TaggedText (%!TT, ...) is not supported by this function! To insert Tagged Text, please use table::insert_taggedtext resp. table::cell::insert_taggedtext. |
| insert_pos | int | Text start | Insert position relative to the table field |
| remove_len | int | up to text end | Length of the text to be deleted beforehand |
| autoload | int | 0 | Are placeholders in the text to be automatically reloaded? 0 : do not load, default otherwise : reload Ignored by Illustrator. |
int main ()
{
Table T = table::alloc ();
if (!T) return 0;
if (table::get (T, 0, 0) != 0)
{
table::release (T);
return 0;
}
table::set_text (T, 1, 1, "Hallo Clara");
table::release (T);
return 0;
}
static char* table::cell::get_text(
Table T,
int left,
int top,
char* str,
int fmt = kExportPlain)
Get the text of a table field The result string must be sufficiently large in order to accommodate the result.
If the text contains InDesign® variables, the internal code used in the document (and not the current value) is exported on pure text formats like kExportPlain. Use the ~Plus~-Formats (available since v3.3 R2883) to replace InDesign® variables by their current values.
| Name | Type | Default | Description |
| Return | String or char* | (Depends on parameter str) Text content of the table field (same as str) | |
| T | Table | - | table used |
| left | int | - | Column (0-based) |
| top | int | - | Row (0-based) |
| str | String or char* | - | Reserved memory for the result |
| fmt | int | kExportPlain | Export format, see here |
int main ()
{
char s [1000];
Table T = table::alloc ();
if (!T) return 0;
if (table::get (T, 0, 0) != 0)
{
table::release (T);
return 0;
}
showmessage ("%s", table::get_text (t, 2,0, s));
showmessage (s);
table::release (T);
return 0;
}
static int table::cell::get_textpos(
Table T,
int cell_x,
int cell_y,
int* start,
int* len)
Text position and length of a table cell.
| Name | Type | Default | Description |
| Return | int | 0 or ErrorCode | |
| T | Table | - | Valid table reference |
| cell_x | int | - | 0-based table column |
| cell_y | int | - | 0-based table row |
| start | int* | - | Position in the text model at which the text is to begin in the table cell. |
| len | int* | - | Length of the text of the table cell. |
An example for the use of the function can be found at table::create.
static int table::cell::insertimage(
Table T,
int col,
int row,
char* path,
float w = -1.0,
float h = -1.0,
int align = 5,
float boundingBox = 0.0,
int start = 0,
int len = -1,
int pindex = -2,
int clipToFrame = 0,
int flags = 4,
float tolerance = 0.0,
float minPathSz = 0.0,
float inset = 0.0)
Insert an image into a cell of a table. Existing text can be partially or completely deleted. The image can be scaled. The image will be directly inserted into the document, not as a reference.
| Name | Type | Default | Description |
| Return | int | 0 or ErrorCode | |
| T | Table | - | Table used |
| col | int | - | Column (0-based) |
| row | int | - | Row (0-based) |
| ⇨ Generell image values | |||
| path | String or char* | - | full path to an image file |
| w | float | -1.0 | width of image frame -1.0 : use cell width |
| h | float | -1.0 | Height of image frame -1.0 : use cell height |
| align | int | kMiddle | image alignment inside the frame |
| boundingBox | float | 0.0 | Image size inside its box in points. 0.0 : Proportionally scale the image to the frame, images smaller than the frame are unchanged >0.0 : Proportionally scale the image to the given size, images smaller than the frame are unchangd <0.0 : Proportionally scale the image to the given size, images smaller than the frame are zoomed |
| ⇨ text values | |||
| start_pos | int | 0 | text position to insert the image |
| len | int | kEnd | How many characters to remove before inserting the image? kEnd end of cell |
| ⇨ clip path | |||
| pindex | int | kIgnoreClipping | 0-based clip path index kIgnoreClipping : Do not change clip path. kResetClipping : Do not apply any clip path. |
| cliptoFrame | int | 0 | fit frame to clip path 0 : leave frame untouched 1 : fit frame to clip path |
| tolerance | float | 0.0 | A tolerance value specifying how close to the original path we must be if we smooth
the path. 0.0 indicates a perfect match. Smoothing may simplify the path, reducing the number of points. |
| minPathSize | float | 0.0 | subpaths smaller than the minPathSize will be deleted |
| inset | float | 0.0 | how far to inset the path |
static int table::cell::insert_taggedtext(
Table T,
int col,
int row,
char* text,
int start_pos =0,
int len =-1,
int autoload =0)
Insert tagged text into a table cell.
| Name | Type | Default | Description |
| Return | int | 0 or ErrorCode | |
| T | Table | - | valid table reference |
| col | int | - | column (0-based) |
| row | int | - | row (0-based) |
| text | String or char* | - | Tagged Text |
| start_pos | int | 0 | insert tagged text here |
| len | int | bis Textende | length of text to delete befort inserting |
| autoload | int | 0 | Loading placeholders inside the text? 0 : do not load otherwisse : load |
int main ()
{
char tt[2000];
Table t = table::alloc ();
if (!T) return 0;
if (table::get (T, 0, 1) != 0)
{
table::release (T);
return 0;
}
strcpy (tt "" );
strcat (tt, "\r\n");
strcat (tt, "" );
strcat (tt, " );
strcat (tt, "0.000000,0.000000,0.000000,1.000000>>");
strcat (tt, "\r\n");
strcat (tt, "" );
strcat (tt, "" );
strcat (tt, "WERK II" );
strcat (tt, "" );
table::insert_taggedtext (T, 0, 1, p, 1, -1);
table::release (T);
return 0;
}
static int table::cell::inserttext(
Table T,
int col,
int row,
char* text,
int start_pos =0,
int len =-1,
int autoload =0)
like insert_taggedtext.
static int table::cell::is_overset(
Table T,
int left,
int top,
int* ovIndex = 0)
Is there a text overset at the given table cell?
The function checks, if the cell itself has an overset. To check whether the complete cell is in overset, use following code :
table::cell::get_textpos (T, col, row, &start, &len);
if (textmodel::position_visible (gFrame, start))
| Name | Type | Default | Description |
| Return | int | 0 : no overset or error detected 1 : overset |
|
| T | Table | - | valid table reference |
| left | int | - | column (0-based) |
| top | int | - | row (0-based) |
| ovIndex | int* | 0 | Index of first character in overset (only defined if the cell has an overset) |
Table breaks may produce big holes in the frames. The function checks for the first table break and insert a new row to fill this hole.
#include "internal/types.h" #include "internal/text.h" #include "internal/table.h"
int main () { Table T = table::alloc (); int result = 0; float minHeight = 20.0; float grace = 2.0; float l, t, r, b; float fl, ft, fr, fb; int i; ItemRef pref = item::alloc (); int firstRow = 0; int rowToBreak= -1; float newHeight = 0.0; int ovi, start, len; char* txt = 0;
frame::bbox (gFrame, &fl, &ft, &fr, &fb);
result = table::get (T, 0, 0); if (result) { showmessage ("Keine Tabelle"), return 0; }
for (i = 0; i < table::rows (T); i++) { firstRow = 0; table::cell::get_box (T, 0, i, kFrameRelative, &l, &t, &r, &b, pref, &firstRow); if (firstRow && i > 0) { // Die Zeile davor muss evtl. höher werden. table::cell::get_box (T, 0, i-1, kFrameRelative, &l, &t, &r, &b, pref, &firstRow); if (b < (fb-ft)- minHeight) rowToBreak = i; break; } } if (rowToBreak < 0) return 0;
newHeight = ((fb-ft) - b) - grace; table::insert_rows (T, rowToBreak, 1); table::resize_rows (T, rowToBreak, 1, newHeight, -1.0, newHeight); textmodel::force_redraw (gFrame);
txt = alloc (32768); for (i = 0; i < table::columns (T); i++) { if (table::cell::is_overset (T, i, rowToBreak, &ovi)) { table::cell::get_text (T, i, rowToBreak, txt, kExportTT); table::cell::insert_taggedtext (T, i, rowToBreak+1, txt);
table::cell::get_textpos (T, i, rowToBreak, &start, &len); frame::replace (gFrame, "", start+ovi, len -ovi);
table::cell::get_textpos (T, i, rowToBreak+1, &start, &len); frame::replace (gFrame, "", start, ovi);
textmodel::force_redraw (gFrame); } } release (txt);
table::resize_rows (T, rowToBreak+1, 1, 0.0, -1.0, -1.0); textmodel::force_redraw (gFrame);
return 0; }
static int table::cell::get_size(
Table T,
int x,
int y,
int areaType,
float* width,
float* height)
Ascertain the cell size in table. The specification is stated in points.
| Name | Type | Default | Description |
| Return | int | 0 or ErrorCode | |
| T | Table | - | table used |
| x | int | - | 0-based column number of the cell |
| y | int | - | 0-based line number of the cell |
| areaType | int | - | Which size of the cell should be calculated?
0 : Size of the cell itself1 : Size of the content area of the cell. The content area is smaller than the cell size itself minus the maximum of inset and half contour width on the respective sides. 2 : Size within the cell strokes. Using InDesign®, the size of the cell content of the entire cell merge is determined here. comet_pdf returns the hypotethic cell size minus cell strokes minus cell insets. |
| width | float* | - | For return=0 : Width of the column otherwise undefined |
| heigth | float* | - | For return=0 : Heigth of the column otherwise undefined |
Determine width and height of the first column of the second line. Do not deduct the insets.
int res; float cw, ch;
res = table::get_cellsize ( t, 0, 1, 0, &cw, &ch);
if (res == 0)showmessage ("%f x %f", cw, ch);
static int table::cell::get_box(
Table T,
int x,
int y,
int area,
float* left,
float* top,
float* right,
float* bottom,
ItemRef parentRef = 0,
int* first_row_in_frame = 0,
int* pg = 0,
char* lay = 0)
Determine the frame of a table cell.
The function can calculate three different frame types. The area type is defined by the function parameter area.
In the screenshot you can see the three different area types:
The data can be calculated relative to the following reference points:
Please note that for cells in overset of course no frame and page relative calculations can be made. For cells in overset the area is always calculated relative to the table and the value of parentRef is set to undefined. The result of parentRef can be checked with with item::defined.
With the following code snippet you can check beforehand whether a cell is in the overset or not:
table::cell::get_textpos (T, x, y, &start, &len);
if (!textmodel::position_visible (fr, start))
{
// Cell in overset
}
For hidden cells of cell merges the anchor cell is automatically used for calculation. With table::cell::is_anchor it can be queried whether a cell is an anchor cell.
| Name | Type | Default | Description |
| Return | int | 0 or ErrorCode | |
| T | Table | - | Table used |
| x, y | int | -,- | Column and row index of the cell (0-based). For hidden cells of cell merges, the anchor cell is automatically used for calculation. With table::cell::is_anchor it can be queried whether a cell is an anchor cell. |
| area | int | - | Which cell area should be calculated? The following specifications are allowed:![]() table relative kCellRect (0) kCellInner (6) kCellContent (1) frame relative kCellFrameRelRect (2) kCellFrameRelInner (4) kCellFrameRelContent (7) page relative kCellPageRelRect (3) kCellPageRelInner (5) kCellPageRelContent (8) The frame- and page-relative specifications are ignored by comet_pdf and always table-relative values are calculated here. |
| left | float* | - | At return=0 : Left side of the cell area in points otherwise undefined |
| top | float* | - | At return=0 : Top side of the cell area in points otherwise undefined |
| right | float* | - | At return=0 : Right side of the cell area in points otherwise undefined |
| bottom | float* | - | At return=0 : Bottom side of the cell area in points otherwise undefined |
| parentRef | ItemRef | 0 | Text frame in which the cell is located For cells in the overset, the specification is empty. Use item::defined for testing! Parameter not supported by comet_pdf. |
| first_row_in_frame | int* | 0 | Is the cell in the first row of the frame? Parameter not supported by comet_pdf. |
| pg | int* | 0 | 1-based page number of the frame in which the table cell is located.
For cells in the overset, the result remains unchanged! Parameter not supported by comet_pdf. |
| lay | String oder char* | 0 | Layer of the frame in which the table cell is located.
For cells in the overset, the result remains unchanged! Parameter not supported by comet_pdf. |
Set a frame over the cell of the current text selection. The frame (here 397) must exist in the document! Note in particular that tf as an ItemRef is already a pointer and therefore does not need & when calling table::cell::get_box!
#include "internal/types.h"
int main () { int selStart; int row, col; // Table and cell insex float l, t, r, b; // Cell co-ordinates int isFirst; Table T = table::alloc (); ItemRef tf = item::alloc (); // Text frame containing the cell ItemRef fr = item::alloc (); // Use this frame to show the result
textmodel::selection (&selStart, 0, 0, 0, T, &col, &row);
if (!item::defined (T)) return 0; item::define (fr, gFrame, 397); // Fill in an existing UID!
table::cell::get_box (T, col, row, kCellPageRelInner, &l, &t, &r, &b, tf, &isFirst);
if (item::defined (tf)) { frame::moveto (fr, l, t); frame::resize (fr, r-l, b-t); if (isFirst) frame::color_rgb (fr, 0, 0, 255); else frame::color_rgb (fr, 0, 255, 0); } else { frame::color_rgb (fr, 255, 0, 0); }
return 0; }
Table breaks may produce big holes in the frames. The function checks for the first table break and insert a new row to fill this hole.
#include "internal/types.h" #include "internal/text.h" #include "internal/table.h"
int main () { Table T = table::alloc (); int result = 0; float minHeight = 20.0; float grace = 2.0; float l, t, r, b; float fl, ft, fr, fb; int i; ItemRef pref = item::alloc (); int firstRow = 0; int rowToBreak = -1; float newHeight = 0.0; int ovi, start, len; char * txt = 0;
frame::bbox (gFrame, &fl, &ft, &fr, &fb);
result = table::get (T, 0, 0); if (result) { showmessage ("Keine Tabelle"), return 0; }
for (i = 0; i < table::rows (T); i++) { firstRow = 0; table::cell::get_box (T, 0, i, kFrameRelative, &l, &t, &r, &b, pref, &firstRow);
if (firstRow && i > 0) { table::cell::get_box (T, 0, i-1, kFrameRelative, &l, &t, &r, &b, pref, &firstRow); if (b < (fb-ft)- minHeight) rowToBreak = i; break; } } if (rowToBreak < 0) return 0;
newHeight = ((fb-ft) - b) - grace; table::insert_rows (T, rowToBreak, 1); table::resize_rows (T, rowToBreak, 1, newHeight, -1.0, newHeight); textmodel::force_redraw (gFrame);
txt = alloc (32768); for (i = 0; i < table::columns (T); i++) { if (table::cell::is_overset (T, i, rowToBreak, &ovi)) { table::cell::get_text (T, i, rowToBreak, txt, kExportTT); table::cell::insert_taggedtext (T, i, rowToBreak+1, txt);
table::cell::get_textpos (T, i, rowToBreak, &start, &len); frame::replace (gFrame, "", start+ovi, len -ovi);
table::cell::get_textpos (T, i, rowToBreak+1, &start, &len); frame::replace (gFrame, "", start, ovi);
textmodel::force_redraw (gFrame); } } release (txt);
table::resize_rows (T, rowToBreak+1, 1, 0.0, -1.0, -1.0); textmodel::force_redraw (gFrame);
return 0; }
static int table::cell::get_insets(
Table T,
int x,
int y,
float* left,
float* top,
float* right,
float* bottom)
Ascertain the insets of a table cell. Results coming in points.
| Name | Type | Default | Description |
| Return | int | 0 or ErrorCode | |
| T | Table | - | Table used |
| x | int | - | 0-based column number of the cell |
| y | int | - | 0-based line number of the cell |
| left | float* | - | Bei return=0 : Left spacing otherwise undefined |
| top | float* | - | Bei return=0 : Top spacing otherwise undefined |
| right | float* | - | Bei return=0 : Right spacing otherwise undefined |
| bottom | float* | - | Bei return=0 :Bottom spacing otherwise undefined |
static int table::cell::get_fillcolor_rgb(
Table T,
int row,
int col,
char* colName = 0,
int* r = 0,
int* g = 0,
int* b = 0,
float* tint = 0,
int* overprint = 0)
Find the fill color of a given table cell. The function gets the RGB values of the color. In addition, tint and the overprint of the given cell can be retreived.
The function may require color conversions. For comet_pdf the color profiles must be fully configured and the input W2ML must be at least from v4.0.5 R13799.
| Name | Type | Default | Description |
| Return | int | 0 oder Fehlercode | |
| T | Table | - | valid table |
| row | int | - | 0-based table row |
| col | int | - | 0-based table column |
| colName | String or char* | 0 | Name of the color (if color is defined in the color panel of the document) |
| r, g, b | int* | 0 | RGB parts of the color 0-255 If the cell uses the "color" [None], r, g and b will get the value -254. |
| tint | float* | 0 | tint in the range of 0.0 - 100.0 |
| overprint | int* | 0 | Fill color overprints? 0: No 1: Yes |
static int table::cell::get_fillcolor_cmyk(
Table T,
int row,
int col,
char* colName = 0,
float* c = 0,
float* m = 0,
float* y = 0,
float* k = 0,
float* tint = 0,
int* overprint = 0)
Find the fill color of a given table cell. The function gets the CMYK values of the color. In addition, tint and the overprint of the given cell can be retreived.
The function may require color conversions. For comet_pdf the color profiles must be fully configured and the input W2ML must be at least from v4.0.5 R13799.
| Name | Type | Default | Description |
| Return | int | 0 oder Fehlercode | |
| T | Table | - | valid table |
| row | int | - | 0-based table row |
| col | int | - | 0-based table column |
| colName | String oder char* | 0 | Name of the color (if color is defined in the color panel of the document) |
| c, m, y, k | int* | 0 | CMYK parts of the color in the range of 0.0 - 100.0 If the cell uses the "color" [None], c, m, y and k will get the value -100.0. |
| tint | float* | 0 | tint in the range of 0.0 - 100.0 |
| overprint | int* | 0 | Fill color overprints? 0: No 1: Yes |
static int table::cell::get_fillcolor_lab(
Table T,
int row,
int col,
char* colName = 0,
int* L = 0,
int* a = 0,
int* b = 0,
float* tint = 0,
int* overprint = 0)
Find the fill color of a given table cell. The function gets the Lab values of the color. In addition, tint and the overprint of the given cell can be retreived.
The function may require color conversions. For comet_pdf the color profiles must be fully configured and the input W2ML must be at least from v4.0.5 R13799.
| Name | Type | Default | Description |
| Return | int | 0 oder Fehlercode | |
| T | Table | - | valid table |
| row | int | - | 0-based table row |
| col | int | - | 0-based table column |
| colName | String or char* | 0 | Name of the color (if color is defined in the color panel of the document) |
| L | float* | 0 | L part of the color in the range of 0.0 -100.0 If the cell uses the "color" [None], L will get the value -1.0. |
| L, a, b | int* | 0 | a,b parts of the color in the range of -127 - 128 If the cell uses the "color" [None], a and b will get the value -1. |
| tint | float* | 0 | tint in the range of 0.0 - 100.0 |
| overprint | int* | 0 | Fill color overprints? 0: No 1: Yes |
static int table::cell::get_stroke(
Table T,
int row,
int col,
int side,
int* linetype,
float* weight)
Retreive type and weight of a cell stroke.
| Name | Type | Default | Description |
| Return | int | 0 oder Fehlercode | |
| T | Table | - | valid table |
| row | int | - | 0-based table row |
| col | int | - | 0-based table column |
| side | int | - | One of the following keys. With negative values you ask for the gap color of the given stroke. eLeftSide eRightSide eTopSide eBottomSide eDiagonal |
| type | int* | 0 | line type. You may get one of the following values on successful return eNone eSolid eThickThick eThinThin eThickThin eThinThick eThickThinThick eThinThickThin seit Version 1.1.19 (8. April 2004): eDashed eDash4X4 eDash3X2 eDots eWavy eStraightHash eRightSlant eLeftSlant eDiamond eJapaneseDots eTriple eTableStrip |
| weight | float* | 0 | line weight in points (on successful return) |
static int table::cell::get_strokecolor_rgb(
Table T,
int row,
int col,
int side,
char* colName = 0,
int* r = 0,
int* g = 0,
int* b = 0,
float* tint = 0,
int* overprint = 0)
Find the fill color of a given side of a table cell. The function gets the RGB values of the color. In addition, tint and the overprint of the given cell can be retreived.
The function may require color conversions. For comet_pdf the color profiles must be fully configured and the input W2ML must be at least from v4.0.5 R13799.
| Name | Type | Default | Description |
| Return | int | 0 oder Fehlercode | |
| T | Table | - | valid table |
| row | int | - | 0-based table row |
| col | int | - | 0-based table column |
| side | int | - | One of the following keys. With negative values you ask for the gap color of the given stroke. ±eLeftSide ±eRightSide ±eTopSide ±eBottomSide ±eDiagonal |
| colName | String or char* | 0 | Name of the color (if color is defined in the color panel of the document) |
| r, g, b | int* | 0 | RGB parts of the color 0-255 |
| tint | float* | 0 | tint in the range of 0.0 - 100.0 |
| overprint | int* | 0 | Stroke color overprints? 0: No 1: Yes |
static int table::cell::get_strokecolor_cmyk(
Table T,
int row,
int col,
int side,
char* colName = 0,
float* c = 0,
float* m = 0,
float* y = 0,
float* k = 0,
float* tint = 0,
int* overprint = 0)
Find the fill color of a given side of a table cell. The function gets the CMYK values of the color. In addition, tint and the overprint of the given cell can be retreived.
The function may require color conversions. For comet_pdf the color profiles must be fully configured and the input W2ML must be at least from v4.0.5 R13799.
| Name | Type | Default | Description |
| Return | int | 0 oder Fehlercode | |
| T | Table | - | valid table |
| row | int | - | 0-based table row |
| col | int | - | 0-based table column |
| side | int | - | One of the following keys. With negative values you ask for the gap color of the given stroke. ±eLeftSide ±eRightSide ±eTopSide ±eBottomSide ±eDiagonal |
| colName | String or char* | 0 | Name of the color (if color is defined in the color panel of the document) |
| c, m, y, k | int* | 0 | CMYK parts of the color in the range of 0.0 - 100.0 |
| tint | float* | 0 | tint in the range of 0.0 - 100.0 |
| overprint | int* | 0 | Stroke color overprints? 0: No 1: Yes |
static int table::cell::get_strokecolor_lab(
Table T,
int row,
int col,
int side,
char* colName = 0,
int* L = 0,
int* a = 0,
int* b = 0,
float* tint = 0,
int* overprint = 0)
Find the fill color of a given side of a table cell. The function gets the Lab values of the color. In addition, tint and the overprint of the given cell can be retreived.
The function may require color conversions. For comet_pdf the color profiles must be fully configured and the input W2ML must be at least from v4.0.5 R13799.
| Name | Type | Default | Description |
| Return | int | 0 oder Fehlercode | |
| T | Table | - | valid table |
| row | int | - | 0-based table row |
| col | int | - | 0-based table column |
| side | int | - | One of the following keys. With negative values you ask for the gap color of the given stroke. ±eLeftSide ±eRightSide ±eTopSide ±eBottomSide ±eDiagonal |
| colName | String or char* | 0 | Name of the color (if color is defined in the color panel of the document) |
| L, a, b | int* | 0 | Lab parts of the color in the range of -127 - 128 |
| tint | float* | 0 | tint in the range of 0.0 - 100.0 |
| overprint | int* | 0 | Stroke color overprints? 0: No 1: Yes |
static float table::cell::get_rotate(
Table T,
int col,
int row)
Get the text rotation of a table cell.
| Name | Type | Default | Description |
| Return | float | One of the values 0.0, 90.0, 180.0 or 270.0 | |
| T | Table | - | valid table |
| col | int | - | 0-based table column |
| row | int | - | 0-based table row |
static int table::cell::apply_style(
Table T,
char* styleName,
int left,
int top,
int right,
int bottom,
int removeOverrides = 0,
int applyParaStyle = 0)
Apply a cell style to a given cell range. With an empty style you can remove current cell styles from the given cell range. Cell styles are invoked with InDesign® CS3. Under InDesign® versions prior to CS3 the function does nothing but returns with an error
| Name | Type | Default | Description |
| Return | int | 0 or ErrorCode | |
| T | Table | - | Valid table reference |
| whichStyle | String or char* | - | The style to apply. If the style is part of a style hierarchy, use the complete ':' delimited path here! "" : remove the current style |
| left | int | - | First column (0-based) |
| top | int | - | First row (0-based) |
| right | int | - | >= 0 : first column that is not to edited further (0-based) -1 : All further columns of the table |
| bottom | int | - | >= 0 : first row that is not to be edited further (0-based) -1 : All further rows of the table |
| removeOverrides | int | 0 | local table overrides should be removed (1) or not (0)
Ignored by Illustrator. |
| applyParaStyle | int | 0 | 1 if the cell style should apply its paragraph style, 0 otherwise.
Ignored by Illustrator. |
static char* table::cell::get_style(
Table T,
int col,
int row)
Find the cell style path and name of a given table cell. In case of some errors or in case of using InDesign® version prior CS3 the function returns "".
| Name | Type | Default | Description |
| Return | char* | Path and name of cell style. ':' is used as path delimiter. "" : No style set or error or InDesign version prior CS3 The return value is read only, do NOT CHANGE. The result will be overridden on following calls to the function. See here to learn more about functions returning r/o char* values. |
|
| T | Table | - | valid table reference |
| col, row | int | - | 0-based table cell |
strcpy (cname, table::cell::get_style (T, 1, 2));
static int table::cell::clear_overrides(
Table T,
int l,
int t,
int r,
int b,
int depth = 2,
int keepTableModuleData = 0,
int refreshPanel = 0)
Clear all cell overrides from the given area that conflict with the applied cell style.
| Name | Type | Default | Description |
| Return | int | 0 or ErrorCode | |
| T | Table | - | Valid table reference |
| l, t, r, b | int | - | Cell range. The indexes are 0 based, r and b are the first cells NOT to be edited anymore. |
| depth | int | 2 | Which overrides are to be removed? 0 : Leave cell overrides untouched 1 : Clears all cell overrides from the given areathat conflict with the applied cell style. If the root cell style is the applied style, then all overrides will be cleared. This will also clear out any overriding paragraph styles, returning the text within the cell to the style's paragraph style. If there is no cell style applied, or the applied cell style does not define the cell style, then the paragraphs are left alone. 2 : Clears out all cell attributes from the given cell area. |
| keepTableModuleData | int | 0 | Which data of the Table Composition should be kept? kKeepAll : Keep all Table Composition data kKeepGroupsAndInfo : Keep groups and info1/2 only kKeepGroups : Keep groups only kKeepInfo : Keep info1/2 only kKeepNothing : Remove all Table Composition data |
| refreshPanel | int | 0 | Update the panel Table Composition at the end? 0 : No, faster 1 : If the panel shows a cell of the current table, it is updated after the change. |
static int table::cell::is_member_of(
Table T,
int left,
int top,
char* groupName)
Check whether a group contains a table cell.
| Name | Type | Default | Description |
| Return | int | 0 : No 1 : Yes |
|
| T | Table | - | valid table reference |
| left | int | - | column (0-based) |
| top | int | - | row (0-based) |
| groupName | String or char* | - | case sensitive name of group |
static int table::cell::clear_groups(
Table T,
int left,
int top,
int updatePanel = 0)
Remove all groups from a table cell.
| Name | Type | Default | Description |
| Return | int | 0 or ErrorCode | |
| T | Table | - | valid table reference |
| left | int | - | column (0-based) |
| top | int | - | row (0-based) |
| updatePanel | int | 0 | Updating the groups list of "Table composition" panel after
clearing? 0 : no update 1 : yes |
static int table::cell::clear(
Table T,
int left,
int top)
Clear the table cells content.
| Name | Type | Default | Description |
| Return | int | 0 or ErrorCode | |
| T | Table | - | valid table reference |
| left | int | - | column (0-based) |
| top | int | - | row (0-based) |
static int table::cell::copy_content(
Table T,
int from_left,
int from_top,
int to_left,
int to_top)
Copy the content of one table cell to another cell of the same table.
| Name | Type | Default | Description |
| Return | int | 0 or ErrorCode | |
| T | Table | - | valid table reference |
| from_left | int | - | column of source (0-based) |
| from_top | int | - | row of source (0-based) |
| to_left | int | - | column of destination (0-based) |
| to_top | int | - | row of destination (0-based) |
static int table::cell::get_rowid(
Table T,
int row,
int* id1 = 0,
int* id2 = 0,
int* id3 = 0,
char* stringid = 0)
Get the ID of a table row.
| Name | Type | Default | Description |
| Return | int | 0 or ErrorCode | |
| T | Table | - | valid table reference |
| row | int | - | row (0-based) |
| id1 | int* | 0 | ID1 of given row |
| id2 | int* | 0 | ID2 of given row |
| id3 | int* | 0 | ID3 of given row |
| stringid | String or char* | 0 | StringID of given row |
Show the ids of table cell [2, 3]
int main ()
{
Table T = table::alloc ();
int id, id2, id3;
char stringid[2000];
int row = 2;
int col = 1;
table::get (T, 0, 0);
table::cell::get_rowid (T, row, &id, &id2, &id3, stringid);
showmessage ("RowID of row %d\r\rid : %d\rid2 : %d\rid2 : %d\rsid : '%s'",
row+1, id, id2, id3, stringid);
table::cell::get_colid (T, col, &id, &id2, &id3, stringid);
showmessage ("ColumnID of column %d\r\rid : %d\rid2 : %d\rid2 : %d\rsid : '%s'",
col+1, id, id2, id3, stringid);
table::cell::get_cellid (T, col, row, &id, &id2, &id3, stringid);
showmessage ("CellID of cell [%d, %d]\r\rid : %d\rid2 : %d\rid2 : %d\rsid : '%s'",
col+1, row+1, id, id2, id3, stringid);
return 0;
}
static int table::cell::get_colid(
Table T,
int col,
int* id1 = 0,
int* id2 = 0,
int* id3 = 0,
char* stringid = 0)
Get the ID of a table column.
| Name | Type | Default | Description |
| Return | int | 0 or ErrorCode | |
| T | Table | - | valid table reference |
| col | int | - | column (0-based) |
| id1 | int* | 0 | ID1 of given column |
| id2 | int* | 0 | ID2 of given column |
| id3 | int* | 0 | ID3 of given column |
| stringid | String or char* | 0 | StringID of given column |
Show the ids of table cell [2, 3]
int main ()
{
Table T = table::alloc ();
int id, id2, id3;
char stringid[2000];
int row = 2;
int col = 1;
table::get (T, 0, 0);
table::cell::get_rowid (T, row, &id, &id2, &id3, stringid);
showmessage ("RowID of row %d\r\rid : %d\rid2 : %d\rid2 : %d\rsid : '%s'",
row+1, id, id2, id3, stringid);
table::cell::get_colid (T, col, &id, &id2, &id3, stringid);
showmessage ("ColumnID of column %d\r\rid : %d\rid2 : %d\rid2 : %d\rsid : '%s'",
col+1, id, id2, id3, stringid);
table::cell::get_cellid (T, col, row, &id, &id2, &id3, stringid);
showmessage ("CellID of cell [%d, %d]\r\rid : %d\rid2 : %d\rid2 : %d\rsid : '%s'",
col+1, row+1, id, id2, id3, stringid);
return 0;
}
static int table::cell::get_cellid(
Table T,
int left,
int top,
int* id1 = 0,
int* id2 = 0,
int* id3 = 0,
char* stringid = 0)
Get the ID of a table cell.
| Name | Type | Default | Description |
| Return | int | 0 or ErrorCode | |
| T | Table | - | valid table reference |
| left | int | - | column (0-based) |
| top | int | - | row (0-based) |
| id1 | int* | 0 | ID1 of given cell |
| id2 | int* | 0 | ID2 of given cell |
| id3 | int* | 0 | ID3 of given cell |
| stringid | String or char* | 0 | StringID of given cell |
Show the ids of table cell [2, 3]
int main ()
{
Table T = table::alloc ();
int id, id2, id3;
char stringid[2000];
int row = 2;
int col = 1;
table::get (T, 0, 0);
table::cell::get_rowid (T, row, &id, &id2, &id3, stringid);
showmessage ("RowID of row %d\r\rid : %d\rid2 : %d\rid2 : %d\rsid : '%s'",
row+1, id, id2, id3, stringid);
table::cell::get_colid (T, col, &id, &id2, &id3, stringid);
showmessage ("ColumnID of column %d\r\rid : %d\rid2 : %d\rid2 : %d\rsid : '%s'",
col+1, id, id2, id3, stringid);
table::cell::get_cellid (T, col, row, &id, &id2, &id3, stringid);
showmessage ("CellID of cell [%d, %d]\r\rid : %d\rid2 : %d\rid2 : %d\rsid : '%s'",
col+1, row+1, id, id2, id3, stringid);
return 0;
}
static int table::cell::set_info1(
Table T,
int left,
int top,
char* info,
int refreshPanel = 0)
Set the table cell informatting Info1.
The values for Info1 and Info2 can also be set directly via the tagged text. Add the following informatting to the CellStart tag:
<CellStart:... <w2Cell: Info1='your text' Info2=your text'> ... >
The texts must be correctly coded:
Masking < and > in \<0x00FC\gt; causes, that these strings cannot be used un-translated. They are automatically translated into the corresponding UTF8 character. This is because the location inside the plugins that reads the values from the InDesign input stream, is used by InDesign for TaggedText and IDMS. But with TaggedText, InDesign already gives us ü here, but for IDMS it is still <0x00FC> and we can't see at this point what kind of import it is.
If you use the table module of the plugins in the table, the above-mentioned content for w2Cell must also contain all other attributes of the table module with valid values. To do this, export the table once in tagged text and get the full tag from the exported text.
| Name | Type | Default | Description |
| Return | int | 0 or ErrorCode | |
| T | Table | - | valid table reference |
| left | int | - | 0-based column number |
| top | int | - | 0-based row number |
| info | String or char* | - | informatting to set |
| refreshPanel | int | 0 | Should the Table Composition panel be updated? 0 : No, faster 1 : If the panel shows a cell of the current table, it is updated after the change. |
static int table::cell::set_info2(
Table T,
int left,
int top,
char* info,
int refreshPanel = 0)
Set the table cell informatting Info2.
The values for Info1 and Info2 can also be set directly via the tagged text. Add the following informatting to the CellStart tag:
<CellStart:... <w2Cell: Info1='your text' Info2=your text'> ... >
The texts must be correctly coded:
Masking < and > in \<0x00FC\gt; causes, that these strings cannot be used un-translated. They are automatically translated into the corresponding UTF8 character. This is because the location inside the plugins that reads the values from the InDesign input stream, is used by InDesign for TaggedText and IDMS. But with TaggedText, InDesign already gives us ü here, but for IDMS it is still <0x00FC> and we can't see at this point what kind of import it is.
If you use the table module of the plugins in the table, the above-mentioned content for w2Cell must also contain all other attributes of the table module with valid values. To do this, export the table once in tagged text and get the full tag from the exported text.
| Name | Type | Default | Description |
| Return | int | 0 or ErrorCode | |
| T | Table | - | valid table reference |
| left | int | - | 0-based column number |
| top | int | - | 0-based row number |
| info | String or char* | - | informatting to set |
| refreshPanel | int | 0 | Should the Table Composition panel be updated? 0 : No, faster 1 : If the panel shows a cell of the current table, it is updated after the change. |
static char* table::cell::get_info1(
Table T,
int left,
int top,
int refreshPanel = 0)
Get the table cell informatting Info1.
| Name | Type | Default | Description |
| Return | char* | Info1 of the given cell
The return value is read only, do NOT CHANGE. The result will be overridden on following calls to the function. See here to learn more about functions returning r/o char* values. @param T Table - valid table reference |
|
| left | int | - | 0-based column number |
| top | int | - | 0-based row number |
| refreshPanel | int | 0 | Should the Table Composition panel be updated? 0 : No, faster 1 : If the panel shows a cell of the current table, it is updated after the change. |
static char* table::cell::get_info2(
Table T,
int left,
int top,
int refreshPanel = 0)
Get the table cell informatting Info2.
| Name | Type | Default | Description |
| Return | char* | Info2 of the given table
The return value is read only, do NOT CHANGE. The result will be overridden on following calls to the function. See here to learn more about functions returning r/o char* values. @param T Table - valid table reference |
|
| left | int | - | 0-based column number |
| top | int | - | 0-based row number |
| refreshPanel | int | 0 | Should the Table Composition panel be updated? 0 : No, faster 1 : If the panel shows a cell of the current table, it is updated after the change. |
static int table::cell::is_anchor(
Table T,
int left,
int top,
int* anchor_left = 0,
int* anchor_top = 0)
Is the given table cell an anchor cell?
| Name | Type | Default | Description |
| Return | int | 0 : not an anchor cell or error 1 : yes |
|
| T | Table | - | Valid table reference |
| left | int | - | 0-based column of the cell |
| top | int | - | 0-based row of the cell |
| anchor_left | int* | 0 | [on return] 0-based column of the anchor cell |
| anchor_top | int* | 0 | [on return] 0-based row of the anchor cell |
int main ()
{
Table T = table::alloc ();
int col, row, i;
int l, t, r, b;
table::get (T, 0, 0);
for (i = 0; i < 2; i++)
{
if (i == 0)
{
row = 6;
col = 5;
}
else
{
row = 4;
col = 3;
}
wlog ("", "Cell [%d, %d] is anchor : %d\n", col, row, table::cell::is_anchor (T, col, row));
table::cell::get_anchor (T, col, row, &l, &t);
wlog ("", "Cell [%d, %d] anchor : [%d, %d]\n", col, row, l, t);
table::cell::get_span (T, col, row, &l, &t, &r, &b);
wlog ("", "Cell [%d, %d] span : [%d, %d, %d, %d]\n\n", col, row, l, t, r, b);
}
return 0;
}
static int table::cell::get_anchor(
Table T,
int left,
int top,
int* anchor_left = 0,
int* anchor_top = 0)
Get the anchor cell of a given table cell.
| Name | Type | Default | Description |
| Return | int | 0 or ErrorCode | |
| T | Table | - | Valid table reference |
| left | int | - | 0-based column of the cell |
| top | int | - | 0-based row of the cell |
| anchor_left | int* | 0 | [on return] 0-based column of the anchor cell |
| anchor_top | int* | 0 | [on return] 0-based row of the anchor cell |
int main ()
{
Table T = table::alloc ();
int col, row, i;
int l, t, r, b;
table::get (T, 0, 0);
for (i = 0; i < 2; i++)
{
if (i == 0)
{
row = 6;
col = 5;
}
else
{
row = 4;
col = 3;
}
wlog ("", "Cell [%d, %d] is anchor : %d\n", col, row, table::cell::is_anchor (T, col, row));
table::cell::get_anchor (T, col, row, &l, &t);
wlog ("", "Cell [%d, %d] anchor : [%d, %d]\n", col, row, l, t);
table::cell::get_span (T, col, row, &l, &t, &r, &b);
wlog ("", "Cell [%d, %d] span : [%d, %d, %d, %d]\n\n", col, row, l, t, r, b);
}
return 0;
}
static int table::cell::get_span(
Table T,
int left,
int top,
int* span_left = 0,
int* span_top = 0,
int* span_right = 0,
int* span_bottom = 0)
Get the cell span of a given table cell.
| Name | Type | Default | Description |
| Return | int | 0 or ErrorCode | |
| T | Table | - | Valid table reference |
| left | int | - | 0-based column of the cell |
| top | int | - | 0-based row of the cell |
| anchor_left | int* | 0 | [on return] 0-based column of the anchor cell |
| anchor_top | int* | 0 | [on return] 0-based row of the anchor cell |
| anchor_left | int* | 0 | [on return] 0-based first column outside the span |
| anchor_top | int* | 0 | [on return] 0-based first row outside the span |
int main ()
{
Table T = table::alloc ();
int col, row, i;
int l, t, r, b;
table::get (T, 0, 0);
for (i = 0; i < 2; i++)
{
if (i == 0)
{
row = 6;
col = 5;
}
else
{
row = 4;
col = 3;
}
wlog ("", "Cell [%d, %d] is anchor : %d\n", col, row, table::cell::is_anchor (T, col, row));
table::cell::get_anchor (T, col, row, &l, &t);
wlog ("", "Cell [%d, %d] anchor : [%d, %d]\n", col, row, l, t);
table::cell::get_span (T, col, row, &l, &t, &r, &b);
wlog ("", "Cell [%d, %d] span : [%d, %d, %d, %d]\n\n", col, row, l, t, r, b);
}
return 0;
}
static int table::cell::get_parent(
Table T,
int left,
int top,
int direction,
int* parent_row = 0,
int* parent_col = 0)
Get the parent cell of a given cell. The parent cell is NOT the hot spot cell created the given cell (this cells are called siblings). The parent cell is the next cell in the given direction, that may have IDs used by the hot spot action(s).
In the following table the yellow cell is the hot spot that created all rows and columns. But the parent cells for the white cells are as follows:
Hotspot für
|
red | green | blue |
| Small | 10 | 12 | 14 |
| Medium | 11 | 13 | 15 |
| Large | 12 | 13 | 16 |
Table must build at least with v3.3.1 R3388 of priint:comet InDesign® Plug-Ins.
| Name | Type | Default | Description |
| Return | int | 0 or ErrorCode | |
| T | Table | - | Valid table reference |
| left | int | - | 0-based column of the cell |
| top | int | - | 0-based row of the cell |
| direction | int | - | Direction to search for a parent 1 : row 2 : column |
| parent_row | int* | 0 | [on return] 0-based row number of the parent cell -1 : no parent cell |
| parent_col | int* | 0 | [on return] 0-based column number of parent cell -1 : no parent cell |
Get all vertical and horizontal parents of the first selected cell of the document.
int main ()
{
Table T = table::alloc ();
ItemRef frame = item::alloc();
int start, len, cl, ct, cr, cb;
int r, c, pr, pc;
char tmp [10000];
char mess [10000];
int dir = 1;
if (!textmodel::available ()) return 0;
textmodel::selection (&start, &len, frame, 0, T, &cl, &ct, &cr, &cb);
if (!table::is_valid (T))
{
showmessage ("No table cell selected.");
return 0;
}
strcpy (mess, "");
for (dir = 1; dir < 3; dir++)
{
if (dir == 1) sprintf (tmp, "Row parents of cell [%d, %d]", ct, cl);
else sprintf (tmp, "\n\nColumn parents of cell [%d, %d]", ct, cl);
strcat (mess, tmp);
r = ct;
c = cl;
while (1)
{
table::cell::get_parent (T, c, r, dir, &pr, &pc);
if (pr < 0) break;
sprintf (tmp, "\n\t[%d, %d]", pr, pc);
strcat (mess, tmp);
r = pr;
c = pc;
}
}
showmessage (mess);
return 0;
}
static int table::set_type(
Table T,
int left,
int top,
int type,
ItemRef outRef = 0)
Set the type of a table cell to text or graphic.
Graphic cells are supported since InDesign® CC 2015. In version sprior CC2015 the function has no meaning.
| Name | Type | Default | Description |
| Return | int | 0 or error rcode | |
| T | Table | - | Valid table reference |
| left | int | - | 0-based column of the cell |
| top | int | - | 0-based row of the cell |
| type | int | - | New cell type 1 : text cell 2 : graphic cell |
| outRef | ItemRef | 0 | After successful return and on graphic cells, the variable contains a
reference to the graphicframe in the cell 0 : ignore otherwise : allocated ItemRef |
static int table::get_type(
Table T,
int left,
int top,
ItemRef outRef = 0)
Get the type and (on graphic cells) the frame reference of a table cell.
Graphic cells are supported since InDesign® CC 2015. In version sprior CC2015 the function has no meaning and will return 0 or 1 always.
| Name | Type | Default | Description |
| Return | int | Tpe of cell 0 : Undefined (error) 1 : text 2 : graphic |
|
| T | Table | - | Gültige Tabellenreferenz |
| T | Table | - | Valid table reference |
| left | int | - | 0-based column of the cell |
| top | int | - | 0-based row of the cell |
| outRef | ItemRef | 0 | After successful return and on graphic cells, the variable contains a
reference to the graphicframe in the cell 0 : ignore otherwise : allocated ItemRef |
Create a 16x16 color spectrum. Color A increases from left to right.
Color B increases from top to bottom. Color C remains constant
int main ()
{
Table T = table::alloc ();
int A = 0;
int C = 0;
int B = 255;
int i, j;
if (!T) return 0;
if (table::create (T, 0, 16, 16, -1, 0, 20.0, 20.0) != 0)
{
table::release (T);
return 0;
}
for (i = 0; i < 16; i++)
{
for (j = 0; j < 16; j++)
{
table::colorize (T,
j, i, j+1, i+1,
B, A, C);
A += 16; --A;
}
A = 0;
++B; B -= 16;
}
table::release (T);
return 0;
}
Alphabetic index HTML hierarchy of classes or Java