def get_xml(self): li = DXB.li(text='AAA', ilvl=0, numId=1) p_tag = DXB.p_tag('BBB') footer_tag = DXB.sectPr_tag(p_tag) body = li + footer_tag xml = DXB.xml(body) return etree.fromstring(xml)
def get_xml(self): run_tags = [DXB.r_tag(i) for i in 'link'] run_tags = [DXB.hyperlink_tag(r_id='rId0', run_tags=run_tags)] run_tags.append(DXB.r_tag('.', is_bold=False)) body = DXB.p_tag(run_tags) xml = DXB.xml(body) return etree.fromstring(xml)
def get_xml(self): run_tags = [] run_tags.append(DXB.r_tag('link')) run_tags.append(DXB.r_tag(None, include_linebreak=True)) run_tags = [DXB.hyperlink_tag(r_id='rId0', run_tags=run_tags)] body = DXB.p_tag(run_tags) xml = DXB.xml(body) return etree.fromstring(xml)
def get_xml(self): p_tag = DXB.p_tag(None) # No text run_tags = [p_tag] # The bug is only present in a hyperlink run_tags = [DXB.hyperlink_tag(r_id='rId0', run_tags=run_tags)] body = DXB.p_tag(run_tags) xml = DXB.xml(body) return etree.fromstring(xml)
def test_get_headings(self): styles = [ DXB.style('heading 1', 'heading 1'), ] xml = DXB.styles_xml(styles) styles_xml = etree.fromstring(xml) styles_dict = get_style_dict(styles_xml) self.assertEqual(styles_dict['heading 1']['header'], 'h2')
def get_xml(self): drawing = DXB.drawing('rId0') tags = [ drawing, ] body = '' for el in tags: body += el xml = DXB.xml(body) return etree.fromstring(xml)
def get_xml(self): pict = DXB.pict(None) tags = [ pict, ] body = '' for el in tags: body += el xml = DXB.xml(body) return etree.fromstring(xml)
def get_xml(self): li_text = [ ('AAA', 0, 1), ('BBB', 0, 1), ('CCC', 0, 1), ] body = '' for text, ilvl, numId in li_text: body += DXB.li(text=text, ilvl=ilvl, numId=numId, bold=True) xml = DXB.xml(body) return etree.fromstring(xml)
def get_xml(self): tags = [ DXB.li(text='AAA', ilvl=1, numId=1), DXB.li(text='BBB', ilvl=3, numId=1), DXB.li(text='CCC', ilvl=2, numId=1), ] body = '' for el in tags: body += el xml = DXB.xml(body) return etree.fromstring(xml)
def get_xml(self): table = DXB.table(num_rows=2, num_columns=2, text=chain( [DXB.p_tag('AAA')], [DXB.p_tag('BBB')], # This tag may have CCC in it, however this tag has no meaning # pertaining to content. ['<w:invalidTag>CCC</w:invalidTag>'], [DXB.p_tag('DDD')], )) body = table xml = DXB.xml(body) return etree.fromstring(xml)
def get_xml(self): li_text = [ ('AAA', 0, 2), ('BBB', 1, 1), ('CCC', 0, 1), ] lis = '' for text, ilvl, numId in li_text: lis += DXB.li(text=text, ilvl=ilvl, numId=numId) xml = DXB.xml(lis) return etree.fromstring(xml)
def get_xml(self): tags = [ DXB.drawing('rId2'), DXB.drawing('rId3'), DXB.drawing('rId4'), ] body = '' for el in tags: body += el xml = DXB.xml(body) return etree.fromstring(xml)
def get_xml(self): li_text = [ ('AAA', 0, 2), # Because AAA and CCC are part of the same list (same list id) # and BBB is different, these need to be split into three # lists (or lose everything from BBB and after. ('BBB', 0, 1), ('CCC', 0, 2), ] lis = '' for text, ilvl, numId in li_text: lis += DXB.li(text=text, ilvl=ilvl, numId=numId) xml = DXB.xml(lis) return etree.fromstring(xml)
def get_xml(self): table = DXB.table( num_rows=2, num_columns=2, text=chain( [DXB.p_tag('AAA')], [DXB.p_tag('BBB')], # This tag may have CCC in it, however this tag has no meaning # pertaining to content. ['<w:invalidTag>CCC</w:invalidTag>'], [DXB.p_tag('DDD')], )) body = table xml = DXB.xml(body) return etree.fromstring(xml)
def get_xml(self): li_text = [ ('AAA', 0, 1), ('BBB', 1, 1), ('CCC', 0, 1), ('DDD', 1, 1), ('EEE', 0, 1), ('FFF', 1, 1), ('GGG', 2, 1), ] body = '' for text, ilvl, numId in li_text: body += DXB.li(text=text, ilvl=ilvl, numId=numId) xml = DXB.xml(body) return etree.fromstring(xml)
def get_xml(self): table = DXB.table(num_rows=2, num_columns=2, text=chain( [DXB.p_tag('DDD')], [DXB.p_tag('EEE')], [DXB.p_tag('FFF')], [DXB.p_tag('GGG')], )) tags = [ DXB.li(text='AAA', ilvl=0, numId=1), DXB.p_tag('BBB'), DXB.li(text='CCC', ilvl=0, numId=1), table, DXB.li(text='HHH', ilvl=0, numId=1), ] body = '' for el in tags: body += el xml = DXB.xml(body) return etree.fromstring(xml)
def get_xml(self): table = DXB.table(num_rows=2, num_columns=2, text=chain( [DXB.p_tag('BBB')], [DXB.p_tag('CCC')], [DXB.p_tag('DDD')], [DXB.p_tag('EEE')], )) # Nest that table in a list. first_li = DXB.li(text='AAA', ilvl=0, numId=1) second = DXB.li(text='FFF', ilvl=0, numId=1) p_tag = DXB.p_tag('GGG') body = '' for el in [first_li, table, second, p_tag]: body += el xml = DXB.xml(body) return etree.fromstring(xml)
def get_xml(self): run_tags = [DXB.r_tag(i) for i in 'insert '] insert_tag = DXB.insert_tag(run_tags) run_tags = [DXB.r_tag(i) for i in 'smarttag'] smart_tag = DXB.smart_tag(run_tags) run_tags = [insert_tag, smart_tag] body = DXB.p_tag(run_tags) xml = DXB.xml(body) return etree.fromstring(xml)
def get_xml(self): p_tag = ''' <w:p w:rsidR="009C063D" w:rsidRDefault="009C063D"> <w:pPr> <w:pStyle w:val="BodyText"/> <w:ind w:left="720"/> <w:rPr> <w:b w:val="0"/> <w:bCs w:val="0"/> </w:rPr> </w:pPr> <w:r> <w:rPr> <w:b w:val="0"/> <w:bCs w:val="0"/> </w:rPr> <w:t>AAA</w:t> </w:r> </w:p> ''' xml = DXB.xml(p_tag) return etree.fromstring(xml)
def get_xml(self): run_tags = [] run_tags = [DXB.hyperlink_tag(r_id='rId0', run_tags=run_tags)] body = DXB.p_tag(run_tags) xml = DXB.xml(body) return etree.fromstring(xml)
def get_xml(self): return etree.fromstring(DXB.xml(''))