@@ -106,50 +106,32 @@ class CT_R(BaseOxmlElement):
106106 """
107107 ``<w:r>`` element, containing the properties and text for a run.
108108 """
109+ rPr = ZeroOrOne ('w:rPr' )
110+ t = ZeroOrMore ('w:t' )
109111 br = ZeroOrMore ('w:br' )
112+ drawing = ZeroOrMore ('w:drawing' )
110113
111- def add_drawing (self , inline_or_anchor ):
112- """
113- Return a newly appended ``CT_Drawing`` (``<w:drawing>``) child
114- element having *inline_or_anchor* as its child.
115- """
116- drawing = OxmlElement ('w:drawing' )
117- self .append (drawing )
118- drawing .append (inline_or_anchor )
119- return drawing
114+ def _insert_rPr (self , rPr ):
115+ self .insert (0 , rPr )
116+ return rPr
120117
121118 def add_t (self , text ):
122119 """
123- Return a newly added CT_T ( <w:t>) element containing *text*.
120+ Return a newly added `` <w:t>`` element containing *text*.
124121 """
125- t = CT_Text . new ( text )
122+ t = self . _add_t ( text = text )
126123 if len (text .strip ()) < len (text ):
127124 t .set (qn ('xml:space' ), 'preserve' )
128- self .append (t )
129125 return t
130126
131- def get_or_add_rPr (self ):
132- """
133- Return the rPr child element, newly added if not present.
134- """
135- rPr = self .rPr
136- if rPr is None :
137- rPr = self ._add_rPr ()
138- return rPr
139-
140- @classmethod
141- def new (cls ):
142- """
143- Return a new ``<w:r>`` element.
144- """
145- return OxmlElement ('w:r' )
146-
147- @property
148- def rPr (self ):
127+ def add_drawing (self , inline_or_anchor ):
149128 """
150- ``<w:rPr>`` child element or None if not present.
129+ Return a newly appended ``CT_Drawing`` (``<w:drawing>``) child
130+ element having *inline_or_anchor* as its child.
151131 """
152- return self .find (qn ('w:rPr' ))
132+ drawing = self ._add_drawing ()
133+ drawing .append (inline_or_anchor )
134+ return drawing
153135
154136 @property
155137 def style (self ):
@@ -171,13 +153,6 @@ def style(self, style):
171153 rPr = self .get_or_add_rPr ()
172154 rPr .style = style
173155
174- @property
175- def t_lst (self ):
176- """
177- Sequence of <w:t> elements in this paragraph.
178- """
179- return self .findall (qn ('w:t' ))
180-
181156 @property
182157 def underline (self ):
183158 """
@@ -194,14 +169,6 @@ def underline(self, value):
194169 rPr = self .get_or_add_rPr ()
195170 rPr .underline = value
196171
197- def _add_rPr (self ):
198- """
199- Return a newly added rPr child element. Assumes one is not present.
200- """
201- rPr = CT_RPr .new ()
202- self .insert (0 , rPr )
203- return rPr
204-
205172
206173class CT_RPr (BaseOxmlElement ):
207174 """
@@ -699,14 +666,6 @@ class CT_Text(BaseOxmlElement):
699666 """
700667 ``<w:t>`` element, containing a sequence of characters within a run.
701668 """
702- @classmethod
703- def new (cls , text ):
704- """
705- Return a new ``<w:t>`` element.
706- """
707- t = OxmlElement ('w:t' )
708- t .text = text
709- return t
710669
711670
712671class CT_Underline (BaseOxmlElement ):
0 commit comments