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

Applying another Table format via script

Advocate ,
Mar 30, 2019 Mar 30, 2019

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
1.7K
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

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

...
Translate
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 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()

}

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

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