コード例 #1
0
ファイル: text.py プロジェクト: castaway/python-pptx
 def _set_text(self, text):
     """Replace runs with single run containing *text*"""
     self.clear()
     r = self.add_run()
     r.text = to_unicode(text)
コード例 #2
0
ファイル: text.py プロジェクト: castaway/python-pptx
 def text(self, str):
     """Set the text of this run to *str*."""
     self._r.t._setText(to_unicode(str))
コード例 #3
0
ファイル: text.py プロジェクト: castaway/python-pptx
 def _set_text(self, text):
     """Replace all text in text frame with single run containing *text*"""
     self.clear()
     self.paragraphs[0].text = to_unicode(text)
コード例 #4
0
ファイル: test_util.py プロジェクト: CSberger/python-pptx
def test_to_unicode_raises_on_non_string():
    """to_unicode(text) raises on *text* not a string"""
    with pytest.raises(TypeError):
        to_unicode(999)
コード例 #5
0
def test_to_unicode_raises_on_non_string():
    """to_unicode(text) raises on *text* not a string"""
    with pytest.raises(TypeError):
        to_unicode(999)
コード例 #6
0
ファイル: table.py プロジェクト: castaway/python-pptx
 def text(self, text):
     """
     Replace all text in cell with single run containing *text*
     """
     self.textframe.text = to_unicode(text)
コード例 #7
0
ファイル: shape.py プロジェクト: castaway/python-pptx
 def _set_text(self, text):
     """Replace all text in shape with single run containing *text*"""
     if not self.has_textframe:
         raise TypeError("cannot set text of shape with no text frame")
     self.textframe.text = to_unicode(text)