本文整理汇总了Python中pydocx.test.document_builder.DocxBuilder.xml方法的典型用法代码示例。如果您正苦于以下问题:Python DocxBuilder.xml方法的具体用法?Python DocxBuilder.xml怎么用?Python DocxBuilder.xml使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pydocx.test.document_builder.DocxBuilder
的用法示例。
在下文中一共展示了DocxBuilder.xml方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_xml
# 需要导入模块: from pydocx.test.document_builder import DocxBuilder [as 别名]
# 或者: from pydocx.test.document_builder.DocxBuilder import xml [as 别名]
def get_xml(self):
p_tags = [
DXB.p_tag(
[
DXB.r_tag([DXB.t_tag('AAA')]),
DXB.r_tag(
[DXB.t_tag('BBB')],
rpr=DXB.rpr_tag({'vertAlign': 'superscript'}),
),
],
),
DXB.p_tag(
[
DXB.r_tag(
[DXB.t_tag('CCC')],
rpr=DXB.rpr_tag({'vertAlign': 'subscript'}),
),
DXB.r_tag([DXB.t_tag('DDD')]),
],
),
]
body = b''
for p_tag in p_tags:
body += p_tag
xml = DXB.xml(body)
return xml
示例2: get_xml
# 需要导入模块: from pydocx.test.document_builder import DocxBuilder [as 别名]
# 或者: from pydocx.test.document_builder.DocxBuilder import xml [as 别名]
def get_xml(self):
run_tags = [DXB.r_tag([DXB.t_tag(i)]) for i in 'BBB']
insert_tags = DXB.insert_tag(run_tags)
p_tag = DXB.p_tag([insert_tags])
body = DXB.li(text='AAA', ilvl=0, numId=0)
body += p_tag
body += DXB.li(text='CCC', ilvl=0, numId=0)
xml = DXB.xml(body)
return xml
示例3: get_xml
# 需要导入模块: from pydocx.test.document_builder import DocxBuilder [as 别名]
# 或者: from pydocx.test.document_builder.DocxBuilder import xml [as 别名]
def get_xml(self):
tags = [
DXB.li(text='AAA', ilvl=0, numId=2),
# Because AAA and DDD are part of the same list (same list id)
# and BBB,CCC are different, these need to be properly formatted
# into a single list where BBB,CCC are added as nested list to AAA item
DXB.li(text='BBB', ilvl=0, numId=1),
DXB.li(text='CCC', ilvl=0, numId=1),
DXB.li(text='DDD', ilvl=0, numId=2),
]
body = b''
for el in tags:
body += el
xml = DXB.xml(body)
return xml