def setfont(font, rgb, typeface=None): feel = font._Font__rPr fill = _SubElement(feel, 'a:solidFill') color = _SubElement(fill, 'a:srgbClr') color.set('val', rgb) if typeface: latin = _SubElement(feel, 'a:latin') latin.set('typeface', typeface)
def set_font_color_and_typeface(font, rgbColor, typeface=None): rPr = font._Font__rPr solidFill = _SubElement(rPr, 'a:solidFill') srgbClr = _SubElement(solidFill, 'a:srgbClr') srgbClr.set('val', rgbColor) if typeface: latin = _SubElement(rPr, 'a:latin') latin.set('typeface', typeface)
def add_run(self): """Return a new run appended to the runs in this paragraph.""" r = _Element("a:r", namespaces("a")) _SubElement(r, "a:t") # work out where to insert it, ahead of a:endParaRPr if there is one endParaRPr = _child(self.__p, "a:endParaRPr") if endParaRPr is not None: endParaRPr.addprevious(r) else: self.__p.append(r) return _Run(r)
def add_run(self): """Return a new run appended to the runs in this paragraph.""" r = _Element('a:r', _nsmap) _SubElement(r, 'a:t') # work out where to insert it, ahead of a:endParaRPr if there is one endParaRPr = _child(self.__p, 'a:endParaRPr') if endParaRPr is not None: endParaRPr.addprevious(r) else: self.__p.append(r) return _Run(r)
def add_run(self): """Return a new run appended to the runs in this paragraph.""" r = _Element('a:r', namespaces('a')) _SubElement(r, 'a:t') # work out where to insert it, ahead of a:endParaRPr if there is one endParaRPr = _child(self.__p, 'a:endParaRPr') if endParaRPr is not None: endParaRPr.addprevious(r) else: self.__p.append(r) return _Run(r)
def font(self): """ |_Font| object containing default character properties for the runs in this paragraph. These character properties override default properties inherited from parent objects such as the text frame the paragraph is contained in and they may be overridden by character properties set at the run level. """ # A _Font instance is created on first access if it doesn't exist. # This can cause "litter" <a:pPr> and <a:defRPr> elements to be # included in the XML if the _Font element is referred to but not # populated with values. if not hasattr(self.__p, "pPr"): pPr = _Element("a:pPr", namespaces("a")) self.__p.insert(0, pPr) if not hasattr(self.__p.pPr, "defRPr"): _SubElement(self.__p.pPr, "a:defRPr") return _Font(self.__p.pPr.defRPr)
def font(self): """ |_Font| object containing default character properties for the runs in this paragraph. These character properties override default properties inherited from parent objects such as the text frame the paragraph is contained in and they may be overridden by character properties set at the run level. """ # A _Font instance is created on first access if it doesn't exist. # This can cause "litter" <a:pPr> and <a:defRPr> elements to be # included in the XML if the _Font element is referred to but not # populated with values. if not hasattr(self.__p, 'pPr'): pPr = _Element('a:pPr', namespaces('a')) self.__p.insert(0, pPr) if not hasattr(self.__p.pPr, 'defRPr'): _SubElement(self.__p.pPr, 'a:defRPr') return _Font(self.__p.pPr.defRPr)
def __minimal_element(self): """ Return element containing the minimal XML for a slide, based on what is required by the XMLSchema. """ sld = _Element('p:sld', _nsmap) _SubElement(sld, 'p:cSld', _nsmap) _SubElement(sld.cSld, 'p:spTree', _nsmap) _SubElement(sld.cSld.spTree, 'p:nvGrpSpPr', _nsmap) _SubElement(sld.cSld.spTree.nvGrpSpPr, 'p:cNvPr', _nsmap) _SubElement(sld.cSld.spTree.nvGrpSpPr, 'p:cNvGrpSpPr', _nsmap) _SubElement(sld.cSld.spTree.nvGrpSpPr, 'p:nvPr', _nsmap) _SubElement(sld.cSld.spTree, 'p:grpSpPr', _nsmap) sld.cSld.spTree.nvGrpSpPr.cNvPr.set('id', '1') sld.cSld.spTree.nvGrpSpPr.cNvPr.set('name', '') return sld