def text(self): """ The text of the ``<a:t>`` child element. """ text = self.t.text # t.text is None when t element is empty, e.g. '<a:t/>' return to_unicode(text) if text is not None else u''
def _set_element_text(self, prop_name, value): """Set string value of *name* property to *value*.""" value = to_unicode(value) if len(value) > 255: tmpl = "exceeded 255 char limit for property, got:\n\n'%s'" raise ValueError(tmpl % value) element = self._get_or_add(prop_name) element.text = value
def text(self): """ The text of the ``<a:t>`` child element. """ t = self.t if t is None: return "" text = t.text return to_unicode(text) if text is not None else ""
def replace_text_frame(text_frame: TextFrame, text_frame_data: TextFrameDataType): clear_text_frame(text_frame) new_text = text_frame_data.value if isinstance( text_frame_data, TextStyle) else text_frame_data if new_text is None: new_text = '' style_paragraph = text_frame.paragraphs[0] style_run = style_paragraph.runs[0] if len( style_paragraph.runs) else style_paragraph.add_run() if isinstance(text_frame_data, TextStyle): # if value type is TextStyleType replace_font_style(style_paragraph, text_frame_data) replace_font_style(style_run, text_frame_data) split_text = to_unicode(f"{new_text}").split('\n') for line_num, line_text in enumerate(split_text): paragraph = text_frame.add_paragraph( ) if line_num != 0 else text_frame.paragraphs[0] replace_paragraphs_text(paragraph, line_text) copy_paragraph_style(style_paragraph, paragraph) copy_font_style(style_run, paragraph.runs[0])
def text(self): """(unicode) str containing text of (required) `a:t` child""" text = self.t.text # t.text is None when t element is empty, e.g. '<a:t/>' return to_unicode(text) if text is not None else ""
def test_to_unicode_raises_on_non_string(): """to_unicode(text) raises on *text* not a string""" with pytest.raises(TypeError): to_unicode(999)
def text(self, str): self._r.text = to_unicode(str)
def text(self, text): self.clear() self._element.append_text(to_unicode(text))
def text(self, text): txBody = self._txBody txBody.clear_content() for p_text in to_unicode(text).split("\n"): p = txBody.add_p() p.append_text(p_text)
def text(self, str): self._r.text = to_unicode(str)
def text(self, text): self.clear() self._element.append_text(to_unicode(text))
def text(self, text): txBody = self._txBody txBody.clear_content() for p_text in to_unicode(text).split("\n"): p = txBody.add_p() p.append_text(p_text)
def text(self, text): self.text_frame.text = to_unicode(text)