IMPORTANT:
this is not a Support Forum! Experienced users might answer from time to time questions posted here. If you need a professional and reliable answer, or if you want to report a bug, please contact Altova Support instead.

Dynamically set cell width Options · View
emalot
Posted: Thursday, May 31, 2018 9:22:14 AM
Rank: Newbie

Joined: 5/31/2018
Posts: 5
Is there any way to set single cell width in a dynamic table nested into another dynamic table?
I tried linking width of cell to 'cell-width' with xpah but it never worked... Should i convert attribute value in some way?

Example xsd:
Code:
<xs:complexType name="my_table_type_2">
    <xs:sequence>
        <xs:element name="single_row" type="multi_line_row" maxOccurs="unbounded" minOccurs="0"/>
    </xs:sequence>
</xs:complexType>
<xs:complexType name="multi_line_row">
    <xs:sequence>
        <xs:element name="single_cell" type="multi_line_cell" maxOccurs="unbounded" minOccurs="0"/>
    </xs:sequence>
</xs:complexType>
<xs:complexType name="multi_line_cell">
    <xs:sequence>
        <xs:element name="single_line" type="xs:string" maxOccurs="unbounded" minOccurs="0"/>
    </xs:sequence>
    <xs:attribute name="font-weight" type="xs:string" use="optional" default=""/>
    <xs:attribute name="cell-width" type="xs:string" use="optional"/>
</xs:complexType>

Example xml:
Code:
<my_table_2>
    <single_row>
        <single_cell font-weight="bold" cell-width="100px">
            <single_line></single_line>
            <single_line></single_line>
            <single_line>TEST N°</single_line>
        </single_cell>
        <single_cell cell-width="100px">
            <single_line>Specimens</single_line>
            <single_line>dia. [mm]</single_line>
            <single_line></single_line>
        </single_cell>
    </single_row>
    <single_row>
        <single_cell cell-width="100px">
            <single_line></single_line>
            <single_line>TTQ+TDS-320447-1 (3)</single_line>
            <single_line></single_line>
        </single_cell>
        <single_cell cell-width="100px">
            <single_line></single_line>
            <single_line>12,50</single_line>
            <single_line></single_line>
        </single_cell>
    </single_row>
</my_table_2>


Example design in attachments!

Any answer is welcome! :-)

File Attachment(s):
prova_hb.xsd (2kb) downloaded 220 time(s).
prova_hb.xml (4kb) downloaded 215 time(s).
prova_hb.sps (7kb) downloaded 211 time(s).

emalot attached the following image(s):
table_2.png

K101
Posted: Friday, June 1, 2018 11:22:22 AM
Rank: Advanced Member

Joined: 2/27/2009
Posts: 565
Please return to your original post and attach your actual files as that makes it easier to help you.
emalot
Posted: Monday, June 4, 2018 7:31:48 AM
Rank: Newbie

Joined: 5/31/2018
Posts: 5
I did it. Hope this will help :-)
K101
Posted: Wednesday, June 6, 2018 9:03:53 AM
Rank: Advanced Member

Joined: 2/27/2009
Posts: 565
Quote:
I tried linking width of cell to 'cell-width' with xpah but it never worked.


It looks like it works to me. Some of your single_cell elements have a cell-width attribute value of '100px' and, indeed, when we preview output those cells appear to be 100px wide.

The only problem I see is that your single_cell elements whose cell-width attribute has a percentage width such as 25% don't cause the inner table to expand wider than necessary, but that's because the relative percentage width has no parent container to base the width on.

That is, the inner table itself has no intrinsic width. You can apply one in case the cell-widths are relative using an XPath expression for the inner table such as the following.

Code:
if ( contains( single_cell[1]/@cell-width, '%' ) ) then '100%' else ''


You can replace the 100% with whatever you want.

File Attachment(s):
prova_hb.new.pxf (119kb) downloaded 239 time(s).


emalot
Posted: Friday, June 8, 2018 2:49:21 PM
Rank: Newbie

Joined: 5/31/2018
Posts: 5
Sorry, this is not working for me... I forgot to say that I need to transform to Word2007+ format
Users browsing this topic
guest

Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Use of the Altova User Forum(s) is governed by the Altova Terms of Use.