cancel
Showing results for 
Search instead for 
Did you mean: 

How to make a table grow horizontaly and fit into the page width ?

Former Member
0 Kudos

HI Gurus,

I have a situation like I have to show a table which should grow horizontally.

Means the Header row will be at left portion of the page and body row should be at right.

Maximum there can be 4 body rows which will come dynamically and whatever the no of body rows

it should be fit into the page width.

when no of body rows is 4 it should look like ,

And when No of  body rows is 2 then it should lokk like ,

i.e it should be fit to page width.

Please give me some inputs .

Thanks,

Sanjeeb

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Sanjeeb,

We now know that table cells are objects which are flowed from right to left within row sub forms. Since row sub forms are flowed by nature, it means that if a cell were a sub form itself, it could be made repeatable and it would then get its own Instance Manager for free! And once we have Instance Managers, we can start adding and removing instances of those cells.

So the trick here lies in converting every cell which constitutes a column into a sub form which then contains the type of object you would normally use to display information in that cell.

So just select each cell in the column and change its type to a sub form . The result will be a cell which is a sub form that contains a text.

Making Cell Sub forms Repeatable

this is one case where you’ll have to use the XML Source tab because the repeatable property isn’t available for cell sub forms on the Object palette’s Binding tab. Since it’s a valid XFA setting, you can set this yourself using the XML Source.

Switch to the XML Source window by selecting “XML Source” from the top-level View menu. Then, insert the following XML inside each sub form which defines a cell:

<occur max="-1"/>

This means that the cell subform goes from looking like this:

<subform layout="tb" name="Col3SF"> <field name="Cell3" w="29.9999mm" h="10mm">

to looking like this:

<subform layout="tb" name="Col3SF"> <occur max="-1"/> <field name="Cell3" w="29.9999mm" h="10mm">

and signifies that the cell will have one initial and minimum instance and can have as many additional instances as you need (no maximum).

the script!

After all that, the script is actually quite straight-forward: To add an instance of a column just add an instance of every repeatable sub form cell that constitute a column. In my sample, I have a 3×3 table and each sub form cell is named “Col3SF”. That means that the script looks like this (in JavaScript):

Table1.HeaderRow._Col3SF.addInstance(0); 
Table1.Row1._Col3SF.addInstance(0); 
Table1.Row2._Col3SF.addInstance(0);
 Table1.Row3._Col3SF.addInstance(0);

Best Regards,

PraveenPulle.

Answers (0)