Introducing Horizontal Repeating Tables

InfoPath 2007 adds horizontal repeating table to the control toolbox for when you want data to be entered or displayed in a structured, tabular format, and when you want users to be able to add additional columns instead of rows.

 

For example, you might use a horizontal repeating table to collect sales data for each quarter:

 

Making it wrap

When designing your form template, horizontal repeating table looks like a composite control -- it’s made from a horizontal repeating section and layout tables (I'll cover horizontal repeating section in my next post). Horizontal repeating table can be configured to wrap or scroll. By default, it will wrap to the next line, to provide a better printing experience.

 

You can change the behavior of the control by resizing the layout tables; for example, to change the wrapping point, resize the rightmost border of the layout table:

 

 

This will allow only two instances of the repeating column to fit on one line; the next two will go to the next line, and so forth:

 

 

Making it scroll

You may want to set an upper bound on the amount of real estate that a horizontal repeating table can take up; in that case, you need to make the control scroll. User experience will then be similar to the following:

 

 

To achieve such behavior, you need to make the following modifications to your form template:

  1. Encapsulate the repeating section component of the horizontal repeating table in a scrolling region.
  2. Set the properties on the scrolling region:
    • Show horizontal scroll bars: always
    • Show vertical scroll bars: never
    • Wrap text: unset
    • Margins: all zero
    • Padding: all zero
    • Size: appropriate height and width
    • Borders: no borders
  3. Resize the rightmost border of the layout table that contains the horizontal repeating table to match the border of the scrolling region.

 

When you’re done, your form template will look similar to the following in Design mode:

 

 

Scrolling is often desirable for electronic forms, but is not ideal for printing. If you want to achieve both, you need to use scrolling in the view that users will see when filling out the form and wrapping in an associated printable view.

 

Data binding of a horizontal repeating table is identical to that of a regular repeating table or section.  Horizontal repeating tables support conditional formatting, data validation, rules, calculations, other InfoPath data features that a regular repeating tables support.

 

Note that horizontal repeating tables are only supported in InfoPath 2007 client.

 

- Alex Weinstein
Program Manager