Skip navigation
ankit_1052
Currently Being Moderated

How to add new Element using ExtendScript

Jul 31, 2012 2:58 AM

Tags: #framemaker10 #add #extendscript #structured_framemaker #element

I need to create a script which look for all tables in a FM file and will add “TableContinuation” Element if not available. I am able to search all tables not having “TableContinuation” element within “TCaption” element. But not able to add New Element using ExtendScript. Could you please help me over here? Bwlow is the function I wrote to add new element. Thank You.


function Table_Continuation()

{

    var flow = app.ActiveDoc.MainFlowInDoc;

    var tbl;

    var textItems = flow.GetText(Constants.FTI_TblAnchor);

 

    for (var i = 0; i < textItems.len; i += 1)

    {

        tbl = textItems[i].obj;

 

        if(tbl.TblTitlePosition != 0)

        {

            var title = tbl.TblTitleElement;

            if(title.ElementType == 9)

            {

                var Caption = title.FirstChildElement;

                var TableCon = Caption.FirstChildElement;

               

                if(!TableCon.ObjectValid())

                {

                    //  Here goes the code to add element named "TableContinuation"

                }

            }  

        }

    }

}

 

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points