示例#1
0
 def to_tree(self, tagname, obj, namespace=None):
     tagname = namespaced(self, tagname, namespace)
     container = Element(tagname)
     if self.count:
         container.set('count', str(len(obj)))
     for v in obj:
         container.append(v.to_tree())
     return container
示例#2
0
文件: fills.py 项目: j5int/openpyxl2
 def to_tree(self, tagname=None, idx=None):
     parent = Element("fill")
     el = Element(self.tagname)
     if self.patternType is not None:
         el.set('patternType', self.patternType)
     for c in self.__elements__:
         value = getattr(self, c)
         if value != Color():
             el.append(value.to_tree(c))
     parent.append(el)
     return parent