Working with InDesign® tables.

You will find a general example for the use of table here.

Version :
23.04.2024, 13:31 Uhr

Working with InDesign® tables. For this module, the import

    #include "internal/table.h"
    #include "internal/text.h"

must be given.

static 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.

Version 1.1.6
org since version 1.3.4 (P/R 74)

priint:comet InDesign® Plug-Ins, comet_pdf

static 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

Version 1.3.4 (P/R 74)

priint:comet InDesign® Plug-Ins, comet_pdf

static int 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.

Version 1.1.6

priint:comet InDesign® Plug-Ins, comet_pdf

static int 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

Version 1.2 (21 July 2005)

priint:comet InDesign® Plug-Ins, comet_pdf

is_valid

static int 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

Version 1.4.1 R383, 28. Jun 2007

priint:comet InDesign® Plug-Ins, comet_pdf

defined

static int 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)

Create a new 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 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 until the end of the text How many characters are to be deleted before the insert?
Ignored by Illustrator.
height float 20.0 Height of the table rows in points
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.
#include "internal/text.h"

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; }

The parameter frameRef is new from Version 1.1.6.
The parameters header, footer, checkInsertion are new from Version 1.2 (21 July 2005)
Value 0.0 for parameter width since 14. Jul 2021, v4.1.8 R27790
Parameter tableStyle since 14. Jul 2021, v4.1.8 R27790

priint:comet InDesign® Plug-Ins, comet_pdf, Illustrator

remove
comet.table.create

static int 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

The parameter frameRef is new from Version 1.1.6.
Referenced table since Version 1.4.2, R 556, 7. Jan. 2008

priint:comet InDesign® Plug-Ins, comet_pdf R7345

get
create
comet.CTable.remove

static int 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
#include "internal/text.h"

Parameter textStart and textLen fromVersion 1.1.7, January 2005

priint:comet InDesign® Plug-Ins, comet_pdf

get
create
comet.CFrame.getNthTable

static int 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
#include "internal/text.h"

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; }

Parameter textStart and textLen from Version 1.1.7, Januar 2005 The parameter frameRef is new from Version 1.1.6.

priint:comet InDesign® Plug-Ins, comet_pdf

comet.CFrame.getTableCount

static int 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
@sese comet.CTable.getRowCount
#include "internal/table.h"

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; }

Parameter rowType since version 1.3.3 (P/R 49)

priint:comet InDesign® Plug-Ins, comet_pdf, Illustrator

static int get_rows(Table T, int rowType = 0)

Synonym for rows.

#include "internal/table.h"

11. Oct. 2007

priint:comet InDesign® Plug-Ins, comet_pdf, Illustrator

comet.CTable.getRowCount

static int columns(Table T)

Count the columns of a table.

Name Type Default Description
Return int   Column count
T Table - table used
#include "internal/table.h"


priint:comet InDesign® Plug-Ins, comet_pdf, Illustrator

For example see count
comet.CTable.getColumnCount

static int get_columns(Table T)

Synonym for columns

11. Oct. 2007

priint:comet InDesign® Plug-Ins, comet_pdf, Illustrator

comet.CTable.getColumnCount

static int get_cellsize(
  Table T,
  int x,
  int y,
  int insetRelative,
  float* width,
  float* height)

Size of a table cell in points


priint:comet InDesign® Plug-Ins, comet_pdf R7345, Illustrator

cell::get_size

static int 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.


priint:comet InDesign® Plug-Ins

cell::get_box

static int get_cellinsets(
  Table T,
  int x,
  int y,
  float* left,
  float* top,
  float* right,
  float* bottom)

Insets of a table cell


priint:comet InDesign® Plug-Ins, comet_pdf, comet_pdf R7345, Illustrator

cell::get_insets

static int 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; }

Key words eBefore and eAfter are defined since version 1.3.3. (P/R 56). Pre versions are using -1 resp. 1.

Parameter clearTags since Version 2.1 R663, 4.4.2008

priint:comet InDesign® Plug-Ins, comet_pdf, Illustrator

comet.CTable.insertRows
table::insert_cols

static int 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

Key words eBefore and eAfter are defined since version 1.3.3. (P/R 56). Pre versions are using -1 resp. 1.

Parameter clearTags since Version 2.1 R663, 4.4.2008

priint:comet InDesign® Plug-Ins, Illustrator

comet.CTable.insertColumns
table::insert_rows

static int 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; }

v1.0

priint:comet InDesign® Plug-Ins, comet_pdf, Illustrator

comet.CTable.setRowHeight

static int 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; }


priint:comet InDesign® Plug-Ins, comet_pdf, Illustrator

comet.CTable.setColumnWidth

static int 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.

v4.1.8 R28462, 27. Apr 2021

priint:comet InDesign® Plug-Ins, comet_pdf

move_cols
mirror

static int 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.

v4.1.8 R28462, 27. Apr 2021

priint:comet InDesign® Plug-Ins, comet_pdf

move_rows
mirror

static int 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

v4.1.8 R28462, 27. Apr 2021

priint:comet InDesign® Plug-Ins, comet_pdf

move_rows
move_cols

static int 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 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 is present, an error message is displayed. 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; }

v1.0

priint:comet InDesign® Plug-Ins, comet_pdf, Illustrator

remove_cols
comet.CTable.removeRows

static int 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 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

v1.0

priint:comet InDesign® Plug-Ins, comet_pdf, Illustrator

remove_rows
comet.CTable.removeColums

static int convert_to_headerrows(Table T, int rows = 1)

Convert body rows to header rows. Always the first body row is converted. If there ist only one body row in the table, the function returns an error.

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.
#include "internal/table.h"

Version 1.3.3 (P/R 49)

priint:comet InDesign® Plug-Ins, comet_pdf

static int 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
rows int 1 number of rows to convert
#include "internal/table.h"

Version 1.3.3 (P/R 49)

priint:comet InDesign® Plug-Ins, comet_pdf

static int convert_to_footerrows(Table T, int rows = 1)

Convert body rows to footer rows. Always the last body row is converted. If there ist only one body row in the table, the function returns an error.

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.
#include "internal/table.h"

Version 1.3.3 (P/R 49)

priint:comet InDesign® Plug-Ins, comet_pdf

static int 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 Zeile (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 using the name of a color field
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 using RGB
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; }


priint:comet InDesign® Plug-Ins, comet_pdf, Illustrator

colorize_rows
colorize_cols
comet.CTable.setCellFill

static int colorize_cmyk(
  Table T,
  int left,
  int top,
  int right,
  int bottom,
  float c,
  float m,
  float y,
  float k,
  float tint =0.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 Zeile (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 using RGB
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

v3.4 R5930, 8. Oct 2014

priint:comet InDesign® Plug-Ins, comet_pdf

static int 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 using the name of a color field
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 using RGB
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; }


priint:comet InDesign® Plug-Ins, comet_pdf

colorize
colorize_cmyk
colorize_cols
comet.CTable.colorize

static int 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.

comet.CTable.colorize

static int 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

Version 1.4

priint:comet InDesign® Plug-Ins

static int 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-basiert)
right int - >= 0 first column nicht mehr bearbeitet werden soll (0-basiert)
-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);


priint:comet InDesign® Plug-Ins, comet_pdf

static int 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 nicht mehr bearbeitet werden soll (0-basiert)
-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 - 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);


priint:comet InDesign® Plug-Ins, comet_pdf

static int 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 nicht mehr bearbeitet werden soll (0-basiert)
-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 - 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.
#include "internal/table.h"
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; }


priint:comet InDesign® Plug-Ins, Illustrator

comet.CTable.setStroke

static int 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 nicht mehr bearbeitet werden soll (0-basiert)
-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);


priint:comet InDesign® Plug-Ins, comet_pdf

comet.CTable.setStroke

static int split(
  Table T,
  int left,
  int top,
  int direction)

Splitting a table field. Because splitting means that the numbering of the rows and columns is changed and the splitting of cellareas can then lead to unexpected results terfore, the function works on single cells only.

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


priint:comet InDesign® Plug-Ins

unmerge

static int 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:

  1. rows of pink area
  2. thereby the columns of orange area
  3. thereby the rows of purple area
  4. thereby the columns of green area
  5. thereby the rows of light blue area

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)

Parameter copyPolicy and delimText since v4.0.5 R14200, 9. Dec 2016
Parameter autoExtend since v4.1 R23334, 5. Jul 2018

priint:comet InDesign® Plug-Ins, comet_pdf R7345, Illustrator

merge_equal
unmerge
split
comet.CTable.mergeCells

static int 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.

[ab v4.1.6 R25052] In addition to the text content, the inlines in the text are also checked. It applies:

  1. Inlines must be available in equal numbers and at the same text positions
  2. Settings for the anchor position of the inlies are ignored.
  3. Frame settings like size, color, border, transparency, ... are ignored
  4. Inlines with texts are always regarded as different.
  5. The following applies to image frames
    1. Image paths must be the same
    2. Geometry settings (position, rotation, ...) must be the same
    3. Same (or no) clipping path. Different additional ettings for the same clipping path are ignored.
    4. Gleicher (oder kein) Alphakanal. Different additional settings for the same alpha channel are ignored.

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
8 : away 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
8 : away 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; }

v3.3 R3044, 14.06.2012br/> Parameter flags and counter since v4.1.8 R29014

priint:comet InDesign® Plug-Ins

merge
unmerge
split

static int unmerge(
  Table T,
  int left,
  int top)

Reverse the merger of several table fields to one field.

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)


priint:comet InDesign® Plug-Ins, comet_pdf R7345

merge
split

static int 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


priint:comet InDesign® Plug-Ins

cell::clear

static int 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.


priint:comet InDesign® Plug-Ins, comet_pdf, Illustrator

cell::set_text
comet.CTable.setCellText

static char* 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.

#include "internal/text.h"


priint:comet InDesign® Plug-Ins, comet_pdf (nur Textformat kExportPlain)

cell::get_text
comet.CTable.getCellText

static int 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; }

Version 1.4.2 R470 (28. Sept. 2007)

priint:comet InDesign® Plug-Ins, comet_pdf

cell::get_textpos
get_anchorpos
comet.CTable.getTextPosition

static int 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.

Version 1.4.2 R 556, 7. Jan. 2008

priint:comet InDesign® Plug-Ins, comet_pdf

table::get_textpos
comet.CTable.getAnchorPosition

static int 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 Text start The style is to be changed from here
len int to end of text Length of the text where the style is to be changed
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; }


priint:comet InDesign® Plug-Ins

static int 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 @@param start_pos int Text start The style is to be changed from here
len int to end of text Length of the text where the style is to be changed
#include "internal/text.h"
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; }


priint:comet InDesign® Plug-Ins

static int 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 Text start The style is to be changed from here
len int to end of text Length of the text where the style is to be changed
#include "internal/text.h"
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; }


priint:comet InDesign® Plug-Ins

static int 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
#include "internal/text.h"

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);

Version 1.2.1 (24 August 2005)

priint:comet InDesign® Plug-Ins, comet_pdf

table::align

static int cell_is_overset(
  Table T,
  int left,
  int top,
  int* ovIndex = 0)

Is there a text overset at the given table cell?


priint:comet InDesign® Plug-Ins, comet_pdf

cell::is_overset
comet.CTable.cellHasOverset

static int 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; }


priint:comet InDesign® Plug-Ins, comet_pdf

static int 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 Text start The style is to be changed from here
len int to end of text Length of the text where the style is to be changed
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; }


priint:comet InDesign® Plug-Ins

static int 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 Text start The style is to be changed from here
len int to end of text Length of the text where the style is to be changed
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; }


priint:comet InDesign® Plug-Ins

static int 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 format
start_pos int Text start The style is to be changed from here
len int to end of text Length of the text where the style is to be changed
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; }

Parameter rmvOverrides since v4.1.8 R29558
Parameter exceptThese since v4.1.8 R29556

priint:comet InDesign® Plug-Ins

static int 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 char* - Angle of turn within the range -85.0 - +85.0.
start_pos int Text start The style is to be changed from here
len int to end of text Length of the text where the style is to be changed
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; }


priint:comet InDesign® Plug-Ins

spin

static int spin(
  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 char* - Angle of turn from the perpendicular within the range -85.0 - +85.0.
start_pos int Text start The style is to be changed from here
len int to end of text Length of the text where the style is to be changed
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; }


priint:comet InDesign® Plug-Ins

skew

static int 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 using the name of a color field
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 using RGB
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)
new_name String or char* "" If a name is defined the applied color will be stored under this name in the color field
⇨Weitere allgemeine Parameter
start_pos int Text start The style is to be changed from here
len int to end of text Length of the text where the style is to be changed
table::textcolor (T, l, t, r, b, color [, tint]);
table::textcolor_rgb(T, l, t, r, b, r, g, b
 		[, tint,
 		[, cname]]);
table::textstroke (T, l, t, r, b, color [, tint]); table::textstroke_rgb (T, l, t, r, b, r, g, b   [, tint,   [, cname]]);
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; }


priint:comet InDesign® Plug-Ins

static int 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
align int - One of the following values
kLeft
kCenter
kRight
kJustify
last_align int - Alignment for the last text row. One of the following values
kLeft
kCenter
kRight
kJustify
start_pos int Text start The style is to be changed from here
len int to end of text Length of the text where the style is to be changed
#include "internal/text.h"
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; }


priint:comet InDesign® Plug-Ins

static int 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.


priint:comet InDesign® Plug-Ins, comet_pdf

cell::insertimage

static int 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.


priint:comet InDesign® Plug-Ins, comet_pdf

cell::insert_taggedtext

static int inserttext(
  Table T,
  int col,
  int row,
  char* text,
  int start_pos =0,
  int len =-1,
  int autoload =0)

like cell::insert_taggedtext.


priint:comet InDesign® Plug-Ins, comet_pdf

static int 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)

Version 31. März 2006 (PR44)

priint:comet InDesign® Plug-Ins, comet_pdf

static int 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)

Version 31. März 2006 (PR44)

priint:comet InDesign® Plug-Ins, comet_pdf

static int 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

Version 1.4 (2. August 2006, R137)

priint:comet InDesign® Plug-Ins

static int 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

Version 1.4 (2. August 2006, R137)

priint:comet InDesign® Plug-Ins

static int 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

Version 1.4 (2. August 2006, R137)

priint:comet InDesign® Plug-Ins

static int 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

Version 1.4 (2. August 2006, R137)

priint:comet InDesign® Plug-Ins

static int 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

v3 R2536, 27.06.2011.

priint:comet InDesign® Plug-Ins

static int 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

v3 R2536, 27.06.2011.

priint:comet InDesign® Plug-Ins

static int 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

v3 R2536, 27.06.2011.

priint:comet InDesign® Plug-Ins

static int 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

v3 R2536, 27.06.2011.

priint:comet InDesign® Plug-Ins

static int 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.
#include "internal/table.h"

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; }

Version 1.4 (2. August 2006, R137)
Parameter execActionsOnly since v3.3 R3601, 5. Apr 2013

priint:comet InDesign® Plug-Ins

static int 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; }

Version 1.4 (2. August 2006, R137)

priint:comet InDesign® Plug-Ins

static 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

Version 1.4.1 (R417), 23. Jul. 2007

priint:comet InDesign® Plug-Ins

has_parent

static int 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

Version 1.4.1 (R417), 23. Jul. 2007

priint:comet InDesign® Plug-Ins

get_parent

static int 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; }

Version 1.3.5 (Revision 203, 29. Sept. 2006)
Fit sub tables to their containing cell since v3.3 R2892, 08.05.2012 Parameter columnAware since v4.0.5 R11952, 07. Jul 2016
Parameter cols since v4.2 R32400, 27. Feb 2023

priint:comet InDesign® Plug-Ins, comet_pdf R7345

equal_cols
fit_col
comet.CTable.broadenToFrame

static int 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; }


priint:comet InDesign® Plug-Ins, comet_pdf R7600

broaden_to_frame
fit_col
equal_cols_by_list

static int 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; }

Comet 3.1, R 1590, 8. Oct. 2009

priint:comet InDesign® Plug-Ins, comet_pdf R600

broaden_to_frame
fit_col
equal_cols

static int 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; }

Version 1.3.5 (Revision 203, 29. Sept. 2006)
Parameter keepLineHeights seit v3.3 R3121, 17.08.2012
Parameter precision, maxWidth, emergencyExit since v3.3 R3670, 22.04.2013

priint:comet InDesign® Plug-Ins, comet_pdf

broaden_to_frame
equal_cols
comet.CTable.fitColumn

static int 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 information from the table
Ignored by Illustrator.

Version 2.0, R470, 29. Sept. 2007

priint:comet InDesign® Plug-Ins, comet_pdf, Illustrator

cell::apply_style
comet.CTable.setStyle

static char* 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));

Version 2.0, R485, 23. Oct. 2007

priint:comet InDesign® Plug-Ins, Illustrator

cell::get_style
apply_style
cell::apply_style
comet.CTable.getStyle

static int 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


priint:comet InDesign® Plug-Ins, comet_pdf, Illustrator

cell::apply_style

static int 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 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.
#include "internal/table.h"

v4.1.8 R28010, 26. Jan 2021

priint:comet InDesign® Plug-Ins, comet_pdf

get_style
apply_style
cell::clear_overrides

static int 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 information 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
#include "internal/types.h"

Version 2.0, R 620, 13. Mar 2008

priint:comet InDesign® Plug-Ins

get_keystring
fit_col
decompress_colwise
comet.CTable.compressColumnWise

static int 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

Version 2.1, R 667, 7. April 2008

priint:comet InDesign® Plug-Ins

compress_colwise
comet.CTable.decompressColumnWise

static int 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 :

If a table has already been compressed with woodoo or compress_colwise, it will first be automatically restored to its original state.

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.

Version 2.1, R 1150, 17. Februar 2008

priint:comet InDesign® Plug-Ins

oodoow
decompress_colwise
get_keystring

comet.CTable.woodoo

static int 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.

Version 2.1, R 1150, 17. Februar 2008

priint:comet InDesign® Plug-Ins

woodoo
decompress_colwise
get_keystring
comet.CTable.oodoow

static int 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 :
  • Cell style
  • Color, tint, overprint
  • Insets
  • Rotation
  • Justification (top, centered, ...)
  • all four strokes
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; }

v3.3 R2660, 21. Sept. 2011

priint:comet InDesign® Plug-Ins

unbreak_
compress_colwise
woodoo

static int 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 :
  • Cell style
  • Coor, tint, overprint
  • Insets
  • Rotation
  • Justification (top, centered, ...)
  • all four strokes


priint:comet InDesign® Plug-Ins

break_
compress_colwise
woodoo

static int 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

v3.3 R2660, 21. Sept. 2011

priint:comet InDesign® Plug-Ins

static char* 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 information 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" ...

Version 2.0, R 620, 13. Mar 2008

priint:comet InDesign® Plug-Ins

compress_colwise
comet.CTable.getKeyStr

static int 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; }

Version 2.1, R 1070, 15. Dec. 2008

priint:comet InDesign® Plug-Ins

set_keep_with_next_row

static int 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; }

Version 2.1, R 1070, 15. Dec. 2008

priint:comet InDesign® Plug-Ins

get_keep_with_next_row

static int 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; }

Version 2.1, R 1070, 15. Dec. 2008

priint:comet InDesign® Plug-Ins, comet_pdf

set_row_start

static int 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; }

Version 2.1, R 1070, 15. Dec. 2008

priint:comet InDesign® Plug-Ins, comet_pdf

get_row_start

static int 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; }

Version 2.1, R 1090, 17. December. 2008

priint:comet InDesign® Plug-Ins, comet_pdf R7345

get_footers_start
set_headers_start
set_footers_start
get_skip_first_header
get_skip_last_footer
set_skip_first_header
set_skip_last_footer

static int 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; }

Version 2.1, R 1090, 17. December. 2008

priint:comet InDesign® Plug-Ins, comet_pdf R7345

get_headers_start
set_headers_start
set_footers_start
get_skip_first_header
get_skip_last_footer
set_skip_first_header
set_skip_last_footer

static int 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; }

Version 2.1, R 1090, 17. December. 2008

priint:comet InDesign® Plug-Ins, comet_pdf R7345

get_headers_start
get_footers_start
set_footers_start
get_skip_first_header
get_skip_last_footer
set_skip_first_header
set_skip_last_footer

static int 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; }

Version 2.1, R 1090, 17. December. 2008

priint:comet InDesign® Plug-Ins, comet_pdf R7345

get_headers_start
get_footers_start
set_headers_start
get_skip_first_header
get_skip_last_footer
set_skip_first_header
set_skip_last_footer

static int 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; }

Version 2.1, R 1090, 17. December. 2008

priint:comet InDesign® Plug-Ins, comet_pdf R7345

get_headers_start
get_footers_start
set_headers_start
set_footers_start
get_skip_last_footer
set_skip_first_header
set_skip_last_footer

static int 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; }

Version 2.1, R 1090, 17. December. 2008

priint:comet InDesign® Plug-Ins, comet_pdf R7345

get_headers_start
get_footers_start
set_headers_start
set_footers_start
get_skip_first_header
set_skip_first_header
set_skip_last_footer

static int 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; }

Version 2.1, R 1090, 17. December. 2008

priint:comet InDesign® Plug-Ins, comet_pdf R7345

get_headers_start
get_footers_start
set_headers_start
set_footers_start
get_skip_first_header
get_skip_last_footer
set_skip_last_footer

static int 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; }

Version 2.1, R 1090, 17. December. 2008

priint:comet InDesign® Plug-Ins, comet_pdf R7345

get_headers_start
get_footers_start
set_headers_start
set_footers_start
get_skip_first_header
get_skip_last_footer
set_skip_first_header

static char* get_cellinfo(
  Table T,
  int left,
  int top,
  int which)

Experimentell Get information 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!)

Version 2.1, R1590, 12. Okt. 2009

priint:comet InDesign® Plug-Ins, comet_pdf

set_cellinfo

static int 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.

Version 2.1, R1800, 15.03.2010
Eigenschaft "cellRecordID" seit v4.1.8 R28010, 21. Jan 2021
Parameter refreshPanel since.1.8 R28010, 21. Jan 2021

priint:comet InDesign® Plug-Ins, comet_pdf

get_cellinfo

static int set_info1(
  Table T,
  char* info,
  int refreshPanel = 0)

Set the table information Info1.

The values for Info1 and Info2 can also be set directly via the tagged text. Add the following information 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* - information 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.

v3.2.2 R2366, 23.03.2011
Parameter refreshPanel since v1.8 R28010, 21. Jan 2021

priint:comet InDesign® Plug-Ins

get_info1
get_info2
set_info2
table::cell::get_info1
table::cell::set_info1
table::cell::get_info2
table::cell::set_info2

static int set_info2(
  Table T,
  char* info,
  int refreshPanel = 0)

Set the table information Info2.

The values for Info1 and Info2 can also be set directly via the tagged text. Add the following information 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* - information 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.

v3.2.2 R2366, 23.03.2011
Parameter refreshPanel since v1.8 R28010, 21. Jan 2021

priint:comet InDesign® Plug-Ins

get_info2
get_info1
set_info1
table::cell::get_info1
table::cell::set_info1
table::cell::get_info2
table::cell::set_info2

static char* get_info1(Table T)

Get the table information 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

v3.2.2 R2366, 23.03.2011

priint:comet InDesign® Plug-Ins

set_info1
get_info2
set_info2
table::cell::get_info1
table::cell::set_info1
table::cell::get_info2
table::cell::set_info2

static char* get_info2(Table T)

Get the table information 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

v3.2.2 R2366, 23.03.2011

priint:comet InDesign® Plug-Ins

set_info2
get_info1
set_info1
table::cell::get_info1
table::cell::set_info1
table::cell::get_info2
table::cell::set_info2

static int 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; }

v3.2.2 R2366, 24.03.2011

priint:comet InDesign® Plug-Ins

static char* 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; }

v3.2.2 R2366, 24.03.2011

priint:comet InDesign® Plug-Ins

static float 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)?

v3.4 R7101, 28.11.2014

priint:comet InDesign® Plug-Ins, comet_pdf

comet.CTable.getRowHeight

static float 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)?

v3.4 R7101, 28.11.2014

priint:comet InDesign® Plug-Ins, comet_pdf

static float 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)?

v4.0.5 R14201, 15. Dec 2016

priint:comet InDesign® Plug-Ins, comet_pdf

static float 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)?

v3.4 R7101, 28.11.2014

priint:comet InDesign® Plug-Ins, comet_pdf

comet.CTable.getColumnWidth

static int 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!
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; }

Parameter autoload since Version 1.2 (14 Juni 2005)

priint:comet InDesign® Plug-Ins, comet_pdf, Illustrator

insert_taggedtext
comet.CTable.setText

static char* 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
#include "internal/text.h"
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; }

Parameter fmt since version 1.3.4 (P/R 94)
~Plus~-formats since v3.3 R2883, 20.04.2012

priint:comet InDesign® Plug-Ins, comet_pdf (nur Textformat kExportPlain)

comet.CTable.getCellText

static int 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.


Version 1.2 (21 Juli 2005)

priint:comet InDesign® Plug-Ins, comet_pdf

comet.CTable.getCellTextPosition

static int 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
#include "internal/types.h"

Version 24. March 2006 (P/R43)

alphaIndex, alphaChannel since version 3.1 R1840, 30. April 2010

priint:comet InDesign® Plug-Ins, comet_pdf

frame::image

static int 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; }


priint:comet InDesign® Plug-Ins, comet_pdf

static int cell::inserttext(
  Table T,
  int col,
  int row,
  char* text,
  int start_pos =0,
  int len =-1,
  int autoload =0)

like insert_taggedtext.


priint:comet InDesign® Plug-Ins, comet_pdf

static int 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)
#include "internal/types.h"
#include "internal/text.h"

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; }

Version 1.3.3 (P/R 53)
ovIndex since version 3.2.2 R2366, 22.03.2011

priint:comet InDesign® Plug-Ins, comet_pdf

comet.CTable.cellHasOverset

static int 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 itself

1 : 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);

Version 1.2.1 (24 August 2005)

priint:comet InDesign® Plug-Ins, comet_pdf R7345, Illustrator

comet.CTable.getCellSize

static int 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.
#include "internal/text.h"
#include "internal/types.h"

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; }

Version 1.2.1 (24. August 2005)
parentRef, first_row_in_frame, pg, lay and the relatives since Version 1.4 (R334), Friday 13. April 2007

priint:comet InDesign® Plug-Ins

cell::get_size
comet.CTable.getCellBox
comet.CTable.getCellFrame

static int 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

Version 1.2.1 (24 August 2005)

priint:comet InDesign® Plug-Ins, Illustrator

comet.CTable.getCellInsets

static int 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

11. Oct. 2007, Version 1.42, R 485

priint:comet InDesign® Plug-Ins, comet_pdf

cell::get_fillcolor_cmyk
cell::get_fillcolor_lab
cell::get_strokecolor_rgb
cell::get_strokecolor_cmyk
cell::get_strokecolor_lab

static int 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

11. Oct. 2007, Version 1.42, R 485

priint:comet InDesign® Plug-Ins, comet_pdf

cell::get_fillcolor_rgb
cell::get_fillcolor_lab
cell::get_strokecolor_rgb
cell::get_strokecolor_cmyk
cell::get_strokecolor_lab

static int 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

11. Oct. 2007, Version 1.42, R 485

priint:comet InDesign® Plug-Ins, comet_pdf

cell::get_fillcolor_rgb
cell::get_fillcolor_cmyk
cell::get_strokecolor_rgb
cell::get_strokecolor_cmyk
cell::get_strokecolor_lab

static int 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)
#include "internal/table.h"

11. Oct. 2007, Version 1.42, R 485

priint:comet InDesign® Plug-Ins, comet_pdf

static int 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
#include "internal/table.h"

11. Oct. 2007, Version 1.42, R 485

priint:comet InDesign® Plug-Ins, comet_pdf

cell::get_fillcolor_rgb
cell::get_fillcolor_cmyk
cell::get_fillcolor_lab
cell::get_strokecolor_cmyk
cell::get_strokecolor_lab

static int 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
#include "internal/table.h"

11. Oct. 2007, Version 1.42, R 485

priint:comet InDesign® Plug-Ins, comet_pdf

cell::get_fillcolor_rgb
cell::get_fillcolor_cmyk
cell::get_fillcolor_lab
cell::get_strokecolor_rgb
cell::get_strokecolor_lab

static int 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

11. Oct. 2007, Version 1.42, R 485

priint:comet InDesign® Plug-Ins, comet_pdf

cell::get_fillcolor_rgb
cell::get_fillcolor_cmyk
cell::get_fillcolor_lab
cell::get_strokecolor_rgb
cell::get_strokecolor_cmyk

static float 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

12. Oct. 2007, Version 1.42, R 485

priint:comet InDesign® Plug-Ins

rotate

static int cell::apply_style(
  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

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
l, t, r, b int - 0 based cell range, r and b are the first index NOT containing to the range
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.

Version 2.0, R470, 29. Sept. 2007

priint:comet InDesign® Plug-Ins, comet_pdf, Illustrator

apply_tablestyle
cell::clear_overrides
comet.CTable.setCellStyle

static char* 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));

Version 2.0, R485, 23. Oct. 2007

priint:comet InDesign® Plug-Ins, comet_pdf

get_style
apply_style
cell::apply_style
comet.CTable.getCellStyle

static int 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.
#include "internal/table.h"

v4.1.8 R28010, 26. Jan 2021

priint:comet InDesign® Plug-Ins, comet_pdf

get_style
apply_style
cell::apply_style

static int 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

Version 1.4 R305, 27. Jan. 2007

priint:comet InDesign® Plug-Ins

static int 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

Version 1.4 R305, 27. Jan. 2007

priint:comet InDesign® Plug-Ins

static int 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)

Version 1.4 R305, 27. Jan. 2007

priint:comet InDesign® Plug-Ins

static int 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)

Version 1.4 R305, 27. Jan. 2007

priint:comet InDesign® Plug-Ins

static int 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; }

Version 1.4 R339, 4. May 2007

priint:comet InDesign® Plug-Ins, comet_pdf

get_colid
get_cellid

static int 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; }

Version 1.4 R339, 4. May 2007

priint:comet InDesign® Plug-Ins, comet_pdf

get_rowid
get_cellid

static int 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; }

Version 1.4 R339, 4. May 2007

priint:comet InDesign® Plug-Ins, comet_pdf

get_rowid
get_colid

static int cell::set_info1(
  Table T,
  int left,
  int top,
  char* info,
  int refreshPanel = 0)

Set the table cell information Info1.

The values for Info1 and Info2 can also be set directly via the tagged text. Add the following information 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* - information 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.

v3.2.2 R2366, 23.03.2011
Parameter refreshPanel since v1.8 R28010, 21. Jan 2021

priint:comet InDesign® Plug-Ins

table::cell::get_info1
table::cell::get_info2
table::cell::set_info2
get_info1
set_info1
get_info2
set_info2

static int cell::set_info2(
  Table T,
  int left,
  int top,
  char* info,
  int refreshPanel = 0)

Set the table cell information Info2.

The values for Info1 and Info2 can also be set directly via the tagged text. Add the following information 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* - information 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.

v3.2.2 R2366, 23.03.2011
Parameter refreshPanel since v1.8 R28010, 21. Jan 2021

priint:comet InDesign® Plug-Ins

table::cell::get_info1
table::cell::set_info1
table::cell::get_info2
get_info1
set_info1
get_info2
set_info2

static char* cell::get_info1(
  Table T,
  int left,
  int top,
  int refreshPanel = 0)

Get the table cell information 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.

v3.2.2 R2366, 23.03.2011
Parameter refreshPanel since v1.8 R28010, 21. Jan 2021

priint:comet InDesign® Plug-Ins

table::cell::set_info1
table::cell::get_info2
table::cell::set_info2
get_info1
set_info1
get_info2
set_info2

static char* cell::get_info2(
  Table T,
  int left,
  int top,
  int refreshPanel = 0)

Get the table cell information 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.

v3.2.2 R2366, 23.03.2011
Parameter refreshPanel since v1.8 R28010, 21. Jan 2021

priint:comet InDesign® Plug-Ins

table::cell::get_info1
table::cell::set_info1
table::cell::set_info2
get_info1
set_info1
get_info2
set_info2

static int 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; }

v3.3 R2670, 19.10.2011

priint:comet InDesign® Plug-Ins, comet_pdf

table::cell::get_anchor
table::cell::get_span

static int 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; }

v3.3 R2670, 19.10.2011

priint:comet InDesign® Plug-Ins, comet_pdf

table::cell::is_anchor
table::cell::get_span

static int 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; }

v3.3 R2670, 19.10.2011

priint:comet InDesign® Plug-Ins, comet_pdf

table::cell::is_anchor
table::cell::get_anchor

static int 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
  • Rows (Size)
  • Columns (Color)
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; }

v3.3.1 R3388, 28.12.2012

priint:comet InDesign® Plug-Ins

static int 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

v4.0.5 R21000

priint:comet InDesign® Plug-Ins

get_type

static int 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

v4.0.5 R21000

priint:comet InDesign® Plug-Ins

set_type

Preconditions
#include "internal/table.h"

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; }

Author
Paul Seidel
Version
23.04.2024, 13:31 Uhr
Since
Plugin Version 1.1.6
The table module was completely reworked. When using older versions please use the corresponding documentation for table.

Alphabetic index HTML hierarchy of classes or Java