@@ -76,7 +76,6 @@ class ns:
76
76
#__vulnparam_highlighting = True
77
77
#__truncate = True
78
78
_pPr_annotation = False
79
- chartIterator = 0
80
79
81
80
def __init__ (self ):
82
81
self ._meta_init ()
@@ -872,20 +871,18 @@ def _xml_apply_chart(self, chart_struct, values):
872
871
chart_rid = chart .attrib ['{%s}id' % self .ns .r ]
873
872
874
873
# iterator used for identifying copies of charts
875
- self .chartIterator += 1
876
- chartNewId = chart_rid + 'copy' + str (self .chartIterator )
877
-
878
- chart .attrib ['{%s}id' % self .ns .r ] = chartNewId
874
+ newId = self ._openxml .new_rel_id ()
875
+ chart .attrib ['{%s}id' % self .ns .r ] = "rId" + str (newId )
879
876
880
877
# charts/chart.xml
881
878
chart_rel = filter (lambda x : x .attrib ['Id' ] == chart_rid and x .attrib [
882
879
'Type' ] == 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart' ,
883
880
etree .ETXPath ('//{%s}Relationship' % self .ns .a )(self ._xml ))[0 ]
884
881
885
882
chart_rel_target = chart_rel .attrib ['Target' ]
886
- chart_rel_targetCopy = 'copy' + str (self . chartIterator ) + chart_rel_target
883
+ chart_rel_targetCopy = 'copy' + str (newId ) + chart_rel_target
887
884
chart_relCopy = copy .deepcopy (chart_rel )
888
- chart_relCopy .attrib ['Id' ] = chartNewId
885
+ chart_relCopy .attrib ['Id' ] = "rId" + str ( newId )
889
886
chart_relCopy .attrib ['Target' ] = chart_rel_targetCopy
890
887
chart_relParent = chart_rel .getparent ()
891
888
chart_relParent .append (chart_relCopy )
@@ -918,7 +915,7 @@ def _xml_apply_chart(self, chart_struct, values):
918
915
def copyRelPackages (relationship ):
919
916
# the original drawing name used for the chart
920
917
relationshipName = relationship .attrib ["Target" ]
921
- relationshipCopyName = relationshipName .replace ("../" , "../copy" + str (self . chartIterator ))
918
+ relationshipCopyName = relationshipName .replace ("../" , "../copy" + str (newId ))
922
919
relationship .attrib ["Target" ] = relationshipCopyName
923
920
924
921
pkgName = relationshipName .replace ("../" , "/word/" )
0 commit comments