Page 1 of 1

Reserialization of charts causes issues in booleans?

PostPosted: Fri Sep 16, 2011 8:14 am
by jchenry
When attaching an existing chart to a slide and then saving it off, I was unable to open the slidedeck with out repairing it in Office 2011. I dug into the xml and found that boolean attributes in the newly serialized chart xml were coming out as 'true' and 'false' rather than '1' and '0'.

Has anyone else run into this?

I've also attached a pick of the example diff.
..._chart1-tidy.xml - KDiff3-1.jpg
..._chart1-tidy.xml - KDiff3-1.jpg (13.8 KiB) Viewed 1829 times

Re: Reserialization of charts causes issues in booleans?

PostPosted: Wed Sep 21, 2011 12:15 am
by jason
Hi

CT_GradientFillProperties defines attribute rotWithShape to be xsd:boolean

(It is defined like this in ECMA 376 and ECMA 376 2ed)

That means Word should support true or false or '1' or '0': see http://www.w3.org/TR/xmlschema-2/#boolean

How to work around this bug in Office?

We should still support reading 'true' and 'false', since apps other than Office might validly write those values. So this suggests some sort of Marshal Event Callback, or filter (XSLT?) after marshalling, to ensure we write the boolean in a form that Office is happy with.

http://download.oracle.com/javase/6/doc ... tener.html says

The event callbacks are not called when marshalling from an instance of a Java datatype that represents a simple type definition.


so I think that approach won't work.

Re: Reserialization of charts causes issues in booleans?

PostPosted: Sat Sep 24, 2011 7:47 pm
by jason
Hi, I've taken a bit more of a look at this now.

I added a chart to a slide in Powerpoint 2007, and gave it a gradient fill. Then I ran it through pptx4j's RoundTripTest.

I verified @rotWithShape changed from "1" to "true".

However, the pptx still opened happily in both Powerpoint 2007 and 2010.

So this doesn't appear to be a problem. You might check by manually altering the attribute, and confirming your pptx still won't open in Powerpoint 2010.