本文整理汇总了Python中odf.opendocument.OpenDocumentSpreadsheet.contentxml方法的典型用法代码示例。如果您正苦于以下问题:Python OpenDocumentSpreadsheet.contentxml方法的具体用法?Python OpenDocumentSpreadsheet.contentxml怎么用?Python OpenDocumentSpreadsheet.contentxml使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类odf.opendocument.OpenDocumentSpreadsheet
的用法示例。
在下文中一共展示了OpenDocumentSpreadsheet.contentxml方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_ooo_ns
# 需要导入模块: from odf.opendocument import OpenDocumentSpreadsheet [as 别名]
# 或者: from odf.opendocument.OpenDocumentSpreadsheet import contentxml [as 别名]
def test_ooo_ns(self):
""" Check that ooo exists in namespace declarations """
calcdoc = OpenDocumentSpreadsheet()
table = odf.table.Table(name="Costs")
forms = odf.office.Forms()
form = odf.form.Form(
controlimplementation="ooo:com.sun.star.form.component.Form")
lb = odf.form.Listbox(
controlimplementation="ooo:com.sun.star.form.component.ListBox", dropdown="true", id="control1")
form.addElement(lb)
forms.addElement(form)
table.addElement(forms)
# One empty line
tr = odf.table.TableRow()
table.addElement(tr)
tr = odf.table.TableRow()
# One empty cell
cell = odf.table.TableCell()
tr.addElement(cell)
cell = odf.table.TableCell()
draw = odf.draw.Control(
control="control1", height="0.1126in", width="0.798in",
x="0.0303in", y="0.0205in", endcelladdress="Costs.B2",
endx="0.8283in", endy="0.1331in")
cell.addElement(draw)
tr.addElement(cell)
table.addElement(tr)
calcdoc.spreadsheet.addElement(table)
result = unicode(calcdoc.contentxml(),'utf-8')
self.assertNotEqual(-1, result.find(u'''xmlns:ooo="http://openoffice.org/2004/office"'''))