def insert_paragraph_after(self, paragraph, text=None, style=None):
     new_p = OxmlElement("w:p")
     paragraph._p.addnext(new_p)
     new_para = Paragraph(new_p, paragraph._parent)
     if text:
         new_para.add_run(text)
     if style is not None:
         new_para.style = style
     return new_para
def insert_paragraph_after(inparagraph, text=None, style=None):
    """Insert a new paragraph after the given paragraph."""
    new_p = OxmlElement("w:p")
    inparagraph._p.addnext(new_p)

    new_para = Paragraph(new_p, inparagraph._parent)
    if text != None:
        new_para.style = template.styles[style]
        run = new_para.add_run(text)
    return new_para
Exemple #3
0
def _insert_paragraph_after(paragraph, text=None, style=None):
    """Insert a new paragraph after the given paragraph."""
    new_paragraph_oxml = OxmlElement("w:p")
    paragraph._p.addnext(new_paragraph_oxml)
    new_paragraph = Paragraph(new_paragraph_oxml, paragraph._parent)
    if text:
        new_paragraph.add_run(text)
    if style is not None:
        new_paragraph.style = style
    return new_paragraph
def insert_paragraph_after(inparagraph, text=None, style=None):
    """Insert a new paragraph after the given paragraph."""
    new_p = OxmlElement("w:p")
    inparagraph._p.addnext(new_p)
    new_para = Paragraph(new_p, inparagraph._parent)
    if text is not None:
        new_para.add_run(text)
    if style is not None:
        new_para.style = style
    return new_para
Exemple #5
0
 def _insert_paragraph_before(item, text, style=None):
     p = CT_P.add_p_before(item._element)
     p2 = Paragraph(p, item._parent)
     p2.text = text
     p2.style = style
     return p2