Expand my Community achievements bar.

xfa.layout.pageContent return spanned object twice

Avatar

Level 3

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

1 Reply

Avatar

Level 10

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