Copy link to clipboard
Copied
Hi,
I have a script which should remove conditions from a table.
This is based on Rick's blog post:
http://frameautomation.com/removing-conditions-from-text-and-table-rows-part-2/
To test my attempt, create a document with a table, apply a condition (or several) to the table rows and place the insertion mark in the table.
Here is my script attempt:
#target framemaker
"use strict";
#strict on
var loDoc, loTbl, loTRange, loTblCell;
loDoc = app.ActiveDoc;
loTRange = loDoc.TextSelection;
loPgf = loTRange.beg.obj;
loTblCell = loPgf.InTextObj;
loTbl = loTblCell.CellRow.RowTbl;
RemoveCondFmtFromTbl (loTbl);
function RemoveCondFmtFromTbl (foTbl)
// From Rick Quatro.
// http://frameautomation.com/removing-conditions-from-text-and-table-rows-part-2/
{
var loRow, laArrayInCond;
// Remove all conditions from the list and update the row.
loRow = foTbl.FirstRowInTbl;
while (loRow.ObjectValid()) {
laArrayInCond = loRow.InCond;
$.writeln (" laArrayInCond: " + laArrayInCond + "\n" +
" laArrayInCond.length: " + laArrayInCond.length);
laArrayInCond.length = 0;
loRow.InCond = laArrayInCond;
loRow = loRow.NextRowInTbl;
}
} // --- end RemoveCondFmtFromTbl
The values of the laArrayInCond are listed correctly.
However, when I set the array length to 0 and apply the array to a table row, nothing happens.
When I remove conditions from the paragraphs with the table anchor, then this works, but I have to press CTRL+L. loDoc.Reformat/RehyphenateloDoc.Redisplay; does not work.
However, CTRL+L does not help here.
Thank you very much for your help!
Best regards, Winfried
Finally I found a solution. There was a script from Klaus Daube, and @Klaus Göbel pointed me to a missing line (setting also isval). Thank you very much!
This function removes all conditions from all table rows.
function RemoveCondFmtFromTbl (foTbl)
// From Klaus Göbel.
{
var loRow, lProps, lPropIndex;
// Remove all conditions from the list and update the row.
loRow = foTbl.FirstRowInTbl;
while (loRow.ObjectValid()) {
lProps = loRow.GetProps ();
lPropIndex = Get
...
Copy link to clipboard
Copied
Finally I found a solution. There was a script from Klaus Daube, and @Klaus Göbel pointed me to a missing line (setting also isval). Thank you very much!
This function removes all conditions from all table rows.
function RemoveCondFmtFromTbl (foTbl)
// From Klaus Göbel.
{
var loRow, lProps, lPropIndex;
// Remove all conditions from the list and update the row.
loRow = foTbl.FirstRowInTbl;
while (loRow.ObjectValid()) {
lProps = loRow.GetProps ();
lPropIndex = GetPropIndex (lProps, Constants.FP_InCond);
lProps [lPropIndex].propVal.osval.length = 0;
lProps [lPropIndex].propVal.isval.length = 0;
loRow.SetProps (lProps);
loRow = loRow.NextRowInTbl;
}
} // --- end RemoveCondFmtFromTbl