Copy link to clipboard
Copied
Hi,
I have an ExtendScript script which changes the language of all paragraphs.
It also changes the language of those paragraphs which are in tables.
Now I also want to change the table formats so that they contain the paragraphs with the changed language and not with the old language.
However, my script deletes somehow all table formats!
What I do:
For each table format add a new table.
Then the language of all paragraph formats is changed and imported into the file.
Now update the table formats.
for (var li = 0; li < faArrayTables.length; li += 1) // faArrayTables is an array with all these new tables.
{
loTable = faArrayTables [li];
laProps = loTable.GetProps ();
loTblFmt = foDoc.GetNamedObject (Constants.FO_TblFmt, loTable.TblTag);
loTblFmt.SetProps (laProps);
}
loTblFmt.SetProps deletes all table formats!
I guess that I cannot just transfer the properties of an existing table to a table format. And this deletes the table.
How can I update the table format of a table?
Best regards, Winfried
@Klaus Göbel has helped me to get on track.
Here is the correct loop:
for (var li = 0; li < faArrayTables.length; li += 1)
{
loTable = faArrayTables [li];
loPgfTbl = loTable.FirstRowInTbl.FirstCellInRow.FirstPgf;
loTRange = new TextRange ();
loTRange.beg.obj = loPgfTbl;
loTRange.beg.offset = 0;
loTRange.end.obj = loPgfTbl;
loTRange.end.offset = Constants.FV_OBJ_END_OFFSET-1;
foDoc.TextSelection = loTRange;
foDoc.ScrollToText (loTRange);
Fcodes ([FCodes.KBD...
Copy link to clipboard
Copied
@Klaus Göbel has helped me to get on track.
Here is the correct loop:
for (var li = 0; li < faArrayTables.length; li += 1)
{
loTable = faArrayTables [li];
loPgfTbl = loTable.FirstRowInTbl.FirstCellInRow.FirstPgf;
loTRange = new TextRange ();
loTRange.beg.obj = loPgfTbl;
loTRange.beg.offset = 0;
loTRange.end.obj = loPgfTbl;
loTRange.end.offset = Constants.FV_OBJ_END_OFFSET-1;
foDoc.TextSelection = loTRange;
foDoc.ScrollToText (loTRange);
Fcodes ([FCodes.KBD_TBL_DLG_UNIFY_TF]);
}
I had a FrameScript which did the same thing. There I had used an FCode to update the table format. I only copied that approach to ExtendScript.
I had to go into one of the table cells. I do not know, if the text range and the scrolling is needed. Anyway, then I could update the table format with this Fcode command.
Copy link to clipboard
Copied
OK. Scrolling not needed. Only the text range.
Copy link to clipboard
Copied
I find it interesting that a table format has paragraph format defaults for its title, and the paragraph formats for each cell of the first row of each row type (Header, Body, and Footer). However, this information is not exposed to ExtendScript or FrameScript. I wasn't aware of the FCodes.KBD_TBL_DLG_UNIFY_TF command, which seems to take care of this. Thank you for posting and for Klaus giving the information.
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more