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

Applying another Table format via script

Advocate ,
Mar 30, 2019 Mar 30, 2019

Copy link to clipboard

Copied

Looking for a way to change the table format (drop down list in the Table Designer) via scripting. Does anyone know what the Fcode for some 'Apply Table Format' command is? I have no idea what the command would be called like, so GetNamedCommand will not help me here. Should I use SetProps on the TblFormat instead? Has anyone done this before?

TOPICS
Scripting

Views

1.5K

Translate

Translate

Report

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

Enthusiast , Mar 30, 2019 Mar 30, 2019

Hi Jang,

here's a code snippet from Bharat Prakash

function changeTblTag(active)

{

       

    if(active.BookIsSelected || active.FirstSelectedComponentInBook)

        iterateBook(active);

    else if(active.ObjectValid())

        {

                        var flow = active.FirstFlowInDoc;

                        while(flow.ObjectValid())       

                        {

                            var i = 0;

                            var textItems = flow.GetText(Constants.FTI_TblAnchor) // Get all tabl

...

Votes

Translate

Translate
Enthusiast ,
Mar 30, 2019 Mar 30, 2019

Copy link to clipboard

Copied

Hi Jang,

here's a code snippet from Bharat Prakash

function changeTblTag(active)

{

       

    if(active.BookIsSelected || active.FirstSelectedComponentInBook)

        iterateBook(active);

    else if(active.ObjectValid())

        {

                        var flow = active.FirstFlowInDoc;

                        while(flow.ObjectValid())       

                        {

                            var i = 0;

                            var textItems = flow.GetText(Constants.FTI_TblAnchor) // Get all tables in the flow

                           

                            var newtblfmt = active.GetNamedTblFmt(finalTag)

                            while(i<textItems.length)

                            {

                                if(isTableInReferenceOrHiddenPageOrMasterPage(textItems.obj.TextLoc))

                                    i++

                                else

                                {

                                    var currtblfmttag = textItems.obj.TblTag

                                    if(currtblfmttag == iniTag)

                                    {

                                        textItems.obj.SetProps (newtblfmt.GetProps())

                                        tblCount++

                                     }  

                                    i++

                                }

                               

                                if(i == textItems.length)

                                    break;

                            }

                        flow = flow.NextFlowInDoc

                        }

                      //       savedoc(active);  

          }

   

    if(DeleteFormat)

            iniTag.Delete()

}

Votes

Translate

Translate

Report

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
Advocate ,
Mar 30, 2019 Mar 30, 2019

Copy link to clipboard

Copied

LATEST

Hello Klaus,

Thanks for digging this up. It is a lot of code I don't need, but the one vital line solved my problem. Getting the properties of the named table format and applying all those properties to the table object makes sense. And it works.

Ciao

Votes

Translate

Translate

Report

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