Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

How to update a table format with a script

Community Expert ,
Jan 08, 2026 Jan 08, 2026

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

84
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Jan 08, 2026 Jan 08, 2026

@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
...
Translate
Community Expert ,
Jan 08, 2026 Jan 08, 2026

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 08, 2026 Jan 08, 2026

OK. Scrolling not needed. Only the text range.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 08, 2026 Jan 08, 2026
LATEST

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines