xfa.layout.pageContent return spanned object twice

arvindkumar7 15-03-2017

Hi guys,

I am try to get tables with xfa.layout.pageContent(i, "subform"). This works well but when a table that spans multiple pages comes,  that table is returned twice.

First time table is returned for say page 4 and when loop comes to next page 5 same table is returned again.

Can anyone please help, how to get table only once even if it spans many pages.

Thanks

Arvind

Mark Solution

Are these answers useful?
Help other community members by marking useful answers as accepted.

Accepted Solutions (0)

Answers (1)

Answers (1)

BR001
MVP
18-03-2017

Hi Arvind,

You could use xfa.layout.page(...); which returns the first page the object appears on, so if this doesn't equal i then ignore.

You could also avoid the layout methods and just process the form model;

function processTables(node)

{

    if (node.className == "exclGroup" ||

        node.className == "subform"  ||

        node.className == "subformSet" ||

        node.className == "area")

    {

        for (var i = 0; i < node.nodes.length; i++)

        {

            var childNode = node.nodes.item(i);

            if (childNode.className == "subform" && childNode.layout == "table")

            {

                // ... do table stuff ... //

                console.println(childNode.somExpression);

            }        
            processTables(childNode);

        }

    }

}

processTables(form1);

You might need to change form1 to match the name used in your form.

Regards

Bruce