The following script changes the left indentation of all
the tables in a FrameMaker body page by 1 inch. It also changes
the width of the columns to 2 inches. Open a FrameMaker document
that has tables with two columns before running the script.
var doc =app.ActiveDoc
var flow = doc.MainFlowInDoc
var tbl = 0;
var textItems = flow.GetText(FTI_TblAnchor)
for (var i = 0; i < textItems.len; i += 1)
{
tbl = textItems[i].obj;
tbl.TblLeftIndent = (2*72 * 65536);
var tblColWidths = new Metrics (2 * 72 * 65536, 2 * 72 * 65536);
tbl.TblColWidths = tblColWidths;
}
The script creates the document’s main flow using the
MainFlowInDoc
method.
Use the
GetText(FTI_TblAnchor)
method to list all
tables in the main flow. Using a for loop, for each table, use the
TblLeftIndent()
method to
change the left indentation.
Use the
TblColWidths()
method to change the
width of the column. This method accepts the argument in a metric
form. So, create the arguments as a metric object using the
new Metrics()
method.
Note:
By convention, there are 72 points per inch. Multiply the
inch value with 65536 to get the correct value. 1 inch is equal
to 1 * 72 * 65536 points.