Tables - How to conditionally adjust the column width


EDS Publisher allows the conditional formatting of elements inside a document, including dynamic tables. EDS Publisher has the ability to conditionally format columns in order to change the width property.

The width property can have a fixed or proportional value.

  • A fixed width includes length units (in, pt, cm; for example: 
    <fo:table-column column-width="3in"/>).
  • A proportional width is expressed via proportional-column-width function
    (for example, <fo:table-column column-width= "proportional-column-width(20)"/>)
    or by using a percentage sign (for example, <fo:table-column column-width="20%"/>).

The column-width property can be static specified from the template or dynamically allocated form the XML file. We shall discuss both scenarios below.

How to

In order to achieve the desired output we will need to use the XML View. Below are the steps to achieve the desired functionality.

1. From the Ribbon navigate to the View tab and from the Documents Views group select XML View;

2. Add the 'Conditional Formatting' property by using the <xfd:attribute-value> element:

<xfd:attribute-value object="myID" attribute="PropertyName" condition="myCondition" value="PropertyValue"/>


  • object: is the id number that you will need to set on the element, in our example it will be the table column;
  • attribute: this is the Property Name. In this case, it should be: fo:column-width;
  • condition: this is the Condition. You need to add the condition used to hide the column;
  • (for static values) value: this is the Property Value. In this case, should be set to the desired size: 50pt.
  • (for dynamic values) dynamic-value: this is the Property Value.In this case, should contain the xpath  containing the size: "concat(/ns:catalog/@column,'pt')"


3. Set the <xfd:attribute-value> elements as below:

<fo:table-column id="myId"/>

  • In the sample, we wanted to set a dynamic value for the width of the 'Year' column, and a static value for the width of the 'ProductCode' column.
  • We used the following condition for the dynamic call:

<xfd:attribute-value object="YearColumn" attribute="column-width" condition="/ns:catalog/@column" dynamic-value="concat(/ns:catalog/@column,'pt')"/>

  • And the following condition for the static call:

<xfd:attribute-value object="ProductCodeColumn" attribute="column-width" condition="/ns:catalog" value="40pt"/>

4. After adding the attribute, you need to add the id on the column(s) of the table that you want to have the property set, like below:

<fo:table-column fo:id="YearColumn"/>
<fo:table-column fo:id="ProductCodeColumn"/>

Attached you will find a sample created based on these instructions. If you have additional questions, please send an e-mail to our Support Team.

Have more questions? Submit a request


Powered by Zendesk