Skip to content
This repository

Non-standard but schema-valid rId values raise exception on Presentation.open() #3

Closed
scanny opened this Issue · 1 comment

1 participant

Steve Canny
Steve Canny
Owner

Jasper Reports, and perhaps other PresentationML generators, produce relationship id values, some of which do not follow the PowerPoint® client convention of 'rId%d'. In this particular case, the relationship ids included 'rIdSm' for the slide master. A ValueError was thrown in _Relationship._num when this value was encountered.

Steve Canny scanny referenced this issue from a commit
Steve Canny fix issue #3: non-standard rId raises exception
* add try/except block to _Relationship._num to apply numeric value of
9999 to non-standard rIds. This results in those relationships being
sorted to an arbitrary position at the end of the list, behind
relationships with conformant rId values.

* comment out _reltype_ordering assignment in Presentation._load to
prevent presentation rIds from being renumbered, as renumbering was
causing inconsistency between slide master rId stored in
presentation.xml <p:sldMasterIdLst>

* factor __rewrite_sldIdLst() out to a helper method to clarify intent
in Presentation._blob

Full fix would require adding element rewriting code for all four
relationship lists in presentation.xml in Presentation._blob. That
effort is postponed until support is added for manipulating
slideMaster, notesMaster, and/or handoutMaster parts.
6c40121
Steve Canny
Owner

Close inspection of the relevant schema reveals that rId values may be arbitrary xsd:ID strings, starting with a letter or underscore and containing only letters, digits, underscores, periods, and dashes. Renumbering of relationship ids was commented out for now and non-standard rIds are preserved intact through the open() to save() cycle.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.