Thanks for raising this interesting issue.
In Open XML 1ed (ECMA 376), the definition was:
Using xml Syntax Highlighting
<xsd:element name="tblLook" type="CT_ShortHexNumber" minOccurs="0"
maxOccurs="1">
Parsed in 0.000 seconds, using
GeSHi 1.0.8.4
In 2ed, it was changed to:
Using xml Syntax Highlighting
<xsd:element name="tblLook" type="CT_TblLook" minOccurs="0" maxOccurs="1">
<xsd:annotation>
<xsd:documentation>Table Style Conditional Formatting Settings
</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:complexType name="CT_TblLook">
<xsd:attribute name="firstRow" type="s:ST_OnOff">
<xsd:annotation>
<xsd:documentation>First Row
</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="lastRow" type="s:ST_OnOff">
<xsd:annotation>
<xsd:documentation>Last Row
</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="firstColumn" type="s:ST_OnOff">
<xsd:annotation>
<xsd:documentation>First Column
</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="lastColumn" type="s:ST_OnOff">
<xsd:annotation>
<xsd:documentation>Last Column
</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="noHBand" type="s:ST_OnOff">
<xsd:annotation>
<xsd:documentation>No Horizontal Banding
</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="noVBand" type="s:ST_OnOff">
<xsd:annotation>
<xsd:documentation>No Vertical Banding
</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
</xsd:complexType>
Parsed in 0.003 seconds, using
GeSHi 1.0.8.4
The transitional migration XSD allows both forms:
Using xml Syntax Highlighting
<xsd:complexType name="CT_TblLook">
<xsd:attribute name="firstRow" type="s:ST_OnOff"/>
<xsd:attribute name="lastRow" type="s:ST_OnOff"/>
<xsd:attribute name="firstColumn" type="s:ST_OnOff"/>
<xsd:attribute name="lastColumn" type="s:ST_OnOff"/>
<xsd:attribute name="noHBand" type="s:ST_OnOff"/>
<xsd:attribute name="noVBand" type="s:ST_OnOff"/>
<xsd:attribute name="val" type="ST_ShortHexNumber"/>
</xsd:complexType>
Parsed in 0.001 seconds, using
GeSHi 1.0.8.4
With a couple of exceptions, the wml classes in docx4j were generated from the 1st ed schema.
The classes need to be upgraded to support either form. I've created
https://github.com/plutext/docx4j/issues/53 to track this.
In terms of creating the ShortHexNumber, You can do something like:
Using java Syntax Highlighting
Tbl tbl
= Context.
getWmlObjectFactory().
createTbl();
// w:tblPr
String strTblPr
= "<w:tblPr " + Namespaces.
W_NAMESPACE_DECLARATION + ">"
+ "<w:tblStyle w:val=\"TableGrid\"/>"
+ "<w:tblW w:w=\"0\" w:type=\"auto\"/>"
+ "<w:tblLook w:val=\"04A0\"/>"
+ "</w:tblPr>";
TblPr tblPr
= null;
try {
tblPr
= (TblPr
)XmlUtils.
unmarshalString(strTblPr
);
} catch (JAXBException e
) {
// Shouldn't happen
e.
printStackTrace();
}
tbl.
setTblPr(tblPr
);
Parsed in 0.015 seconds, using
GeSHi 1.0.8.4
See TblFactory.
For some reason, tblLook seems to be missing from ObjectFactory, but alternatively you could try:
Using java Syntax Highlighting
CTShortHexNumber tblLook
= new CTShortHexNumber
();
tblLook.
setVal(value
)
Parsed in 0.014 seconds, using
GeSHi 1.0.8.4
or:
Using java Syntax Highlighting
CTShortHexNumber tblLook
= new JAXBElement
<CTShortHexNumber
>(
new QName
("http://schemas.openxmlformats.org/wordprocessingml/2006/main",
"tblLook"),
CTShortHexNumber.
class, TblPr.
class, value
);
Parsed in 0.014 seconds, using
GeSHi 1.0.8.4
You'll have to look in 1ed of the standard, Google or experiment to find out what order the bits are combined into the hex value.
See also
http://msdn.microsoft.com/en-us/library ... =office.12).aspx for Microsoft extensions.