本文整理匯總了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"'''))