Hi Andi (and others),
I can finally report some moderate success and at least I have a workaround
(hack).
Tracing the class-loader information shows that "SchemaGlobalElementImpl" isn't
being loaded and the CTTable$Factory fallback is used instead.
I don't understand why this happening, but just try to deal with the result.
Rather than patching up the XmlObject in the XSLFTable constructor, I've taken
the easier route of fixing the graphical frame to have the correct table
contents, and calling this fix before writing out the presentation contents.
Until the underlying problem gets solved, the following workaround code can be
used by any others with a similar situation.
Cheers,
/mark
--------
/**
* Handle faulty XSLFTable by splicing in the CTTable contents.
*
* These faults are associated with pesky XmlBeans bug (Bugzilla #49934 - see
XSLFTable constructor),
* which is somehow also provoked when the STARCCM NeoDynamicClassLoader is
involved (eg, StarMacro).
*
* @return true if a repair was needed, false otherwise
*/
public static boolean fixupTable(XSLFTable table)
{
// check for bug
//
// without bug:
org.openxmlformats.schemas.drawingml.x2006.main.impl.CTTableImpl
// with bug: org.apache.xmlbeans.impl.values.XmlAnyTypeImpl
XmlCursor cursor =
table.getXmlObject().getGraphic().getGraphicData().newCursor();
boolean hasBug =
(
cursor.toChild(new
QName("http://schemas.openxmlformats.org/drawingml/2006/main", "tbl"))
&& cursor.getObject() instanceof
org.apache.xmlbeans.impl.values.XmlAnyTypeImpl
);
if (hasBug)
{
// remove old tbl content
cursor.removeXmlContents();
// step into tbl element
cursor.toNextToken();
// copy in CTTable content
// - introduces some leading spaces into the xml,
// but this is obviously cosmetic
XmlCursor input = table.getCTTable().newCursor();
input.toStartDoc();
input.copyXmlContents(cursor);
input.dispose();
}
cursor.dispose();
return hasBug;
}
This electronic transmission (and any attachments thereto) is intended solely
for the use of the addressee(s). It may contain confidential or legally
privileged information. If you are not the intended recipient of this message,
you must delete it immediately and notify the sender. Any unauthorized use or
disclosure of this message is strictly prohibited. Faurecia does not guarantee
the integrity of this transmission and shall therefore never be liable if the
message is altered or falsified nor for any virus, interception or damage to
your system.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]