cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Alternate row shading

Highlighted
Amethyst

Alternate row shading

Good morning, we are wanting to implement a way to shade alternate rows in a table. I found this article https://community.ptc.com/t5/Arbortext/alternate-row-shading/m-p/301668 but when I run the acl it gives me an error message A11369 Statement must be inside function definition: local

 

Here is the code from the link that I copied and pasted. What I am hoping is that I can have my cursor in a table and press a function key to cause the script to run.

 

local $loidCaret = oid_caret();# should be a <table>
local $loidArrChildren[];
local $i = 0;
local $loid = oid_null();
local $loidChild = oid_null();
local $lintCellId = 0;
local $loidCellFont = oid_null();
local $lintRowId = 0;
local $lintRowIndex = 0;

oid_find_children($loidCaret, $loidArrChildren, 'entry', 0x04);
for ($i = 1; $i <= count($loidArrChildren); $i++)
{
$loid = $loidArrChildren[$i];

# gets Cell Id
$lintCellId = tbl_oid_cell($loid);
# gets oid of cellfont pi, if any
$loidCellFont = tbl_cell_fontpi($lintCellId, 'find');

# gets row id
$lintRowId = tbl_cell_row(lintCellId);
# gets row index
$lintRowIndex = tbl_row_index($lintRowId);

if (($lintRowIndex % 2) == 1)
{
# creates cellfont pi if it does not exist
if (!oid_valid($loidCellFont))
{
$loidCellFont = tbl_cell_fontpi($lintCellId, 'insert');
}
# modifies shading
oid_modify_attr($loidCellFont, 'Shading', 'gray2');
}
else
{
tbl_cell_fontpi($lintCellId, 'delete');
}
}
}

 

Thanks

 

Bryon

1 REPLY 1
Highlighted

Re: Alternate row shading

The error message means that "local" must be local to a defined function. Specifically, you need to put the code in a function:

 

function rowshading()

{

code here

}

 

Then you can call the function by name.

 

Check the Arbortext Editor Help Center for documentation on ACL functions.

 

Suzanne Napoleon

www.FOSIexpert.com

"WYSIWYG is last-century technology!"

Announcements