Page 1 of 1

Table row properties class looks bizarre

PostPosted: Wed Jan 12, 2011 10:41 pm
by myjupiler
Hello,

I'm trying to add row height property in my table.
I created TrPr object with the factory.

But properties/methods for TrPr don't seem appropriate or complete. It refers to change tracking.
(getIns, getDel, TrPrChange).

No getter/setter to add trHeight property, which is the one I have in my sample doc.

Regards

Re: Table row properties class looks bizarre

PostPosted: Wed Jan 12, 2011 10:47 pm
by myjupiler
Here is the wordml I want/need to achieve :

<w:tr>
<w:trPr>
<w:trHeight w:hRule="exact" w:val="284"/>
</w:trPr>

Re: Table row properties class looks bizarre

PostPosted: Wed Jan 12, 2011 11:14 pm
by jason
Code: Select all
public class TrPr extends CTTrPrBase


CTTrPrBase contains:

Code: Select all
    @XmlElementRefs({
        @XmlElementRef(name = "gridAfter", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = JAXBElement.class),
        @XmlElementRef(name = "cantSplit", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = JAXBElement.class),
        @XmlElementRef(name = "wBefore", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = JAXBElement.class),
        @XmlElementRef(name = "jc", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = JAXBElement.class),
        @XmlElementRef(name = "cnfStyle", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = JAXBElement.class),
        @XmlElementRef(name = "divId", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = JAXBElement.class),
        @XmlElementRef(name = "gridBefore", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = JAXBElement.class),
        @XmlElementRef(name = "hidden", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = JAXBElement.class),
        @XmlElementRef(name = "trHeight", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = JAXBElement.class),
        @XmlElementRef(name = "wAfter", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = JAXBElement.class),
        @XmlElementRef(name = "tblHeader", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = JAXBElement.class),
        @XmlElementRef(name = "tblCellSpacing", namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", type = JAXBElement.class)
    })
    protected List<JAXBElement<?>> cnfStyleOrDivIdOrGridBefore;

Re: Table row properties class looks bizarre

PostPosted: Wed Jan 12, 2011 11:38 pm
by myjupiler
ok but is cnfStyleOrDivIdOrGridBefore initiated automatically ?

And I don't have any trHeight class in classpath.

Re: Table row properties class looks bizarre

PostPosted: Thu Jan 13, 2011 8:13 am
by jason
From a glance at that class (have you checked out the source code?):

Code: Select all
   /**
     * Gets the value of the cnfStyleOrDivIdOrGridBefore property.
     *
     * <p>
     * This accessor method returns a reference to the live list,
     * not a snapshot. Therefore any modification you make to the
     * returned list will be present inside the JAXB object.
     * This is why there is not a <CODE>set</CODE> method for the cnfStyleOrDivIdOrGridBefore property.
     *
     * <p>
     * For example, to add a new item, do as follows:
     * <pre>
     *    getCnfStyleOrDivIdOrGridBefore().add(newItem);
     * </pre>
     *
     *
     * <p>
     * Objects of the following type(s) are allowed in the list
     * {@link JAXBElement }{@code <}{@link CTTrPrBase.GridAfter }{@code >}
     * {@link JAXBElement }{@code <}{@link BooleanDefaultTrue }{@code >}
     * {@link JAXBElement }{@code <}{@link TblWidth }{@code >}
     * {@link JAXBElement }{@code <}{@link Jc }{@code >}
     * {@link JAXBElement }{@code <}{@link CTCnf }{@code >}
     * {@link JAXBElement }{@code <}{@link CTTrPrBase.DivId }{@code >}
     * {@link JAXBElement }{@code <}{@link CTTrPrBase.GridBefore }{@code >}
     * {@link JAXBElement }{@code <}{@link CTHeight }{@code >}
     * {@link JAXBElement }{@code <}{@link BooleanDefaultTrue }{@code >}
     * {@link JAXBElement }{@code <}{@link TblWidth }{@code >}
     * {@link JAXBElement }{@code <}{@link TblWidth }{@code >}
     * {@link JAXBElement }{@code <}{@link BooleanDefaultTrue }{@code >}
     *
     *
     */
    public List<JAXBElement<?>> getCnfStyleOrDivIdOrGridBefore() {
        if (cnfStyleOrDivIdOrGridBefore == null) {
            cnfStyleOrDivIdOrGridBefore = new ArrayList<JAXBElement<?>>();
        }
        return this.cnfStyleOrDivIdOrGridBefore;
    }


you can see it is inited automatically, and you can guess the element you are after is CTHeight

You can confirm this by looking at wml.xsd, which says trHeight is of type "CT_Height".

Re: Table row properties class looks bizarre

PostPosted: Sat Jan 15, 2011 9:12 pm
by myjupiler
No, I had problems configuring my SVN plugin in Eclipse.

Thanks !