# ----------- heading = odf_create_heading(1, text=u'Chapter') body.append(heading) text = u'The current chapter is: ' paragraph = odf_create_paragraph(text, style=u"Standard") body.append(paragraph) paragraph.insert_variable( odf_create_chapter_variable(display='number-and-name'), u"is: ") # 11- Filename # ------------ heading = odf_create_heading(1, text=u'Filename') body.append(heading) text = u'The current file name is: ' paragraph = odf_create_paragraph(text, style=u"Standard") body.append(paragraph) paragraph._insert_between(odf_create_filename_variable(), u"The", u"is: ") # Save # ---- if not exists('test_output'): mkdir('test_output') document.save('test_output/use_case2.odt', pretty=True)
def test_create_filename_fixed(self): filename = odf_create_filename_variable(fixed=True) expected = '<text:file-name text:display="full" text:fixed="true"/>' self.assertEqual(filename.serialize(), expected)
text = u'The current chapter is: ' paragraph = odf_create_paragraph(text, style=u"Standard") body.append(paragraph) paragraph.insert_variable(odf_create_chapter_variable(display='number-and-name'), u"is: ") # 10- Filename # ------------ heading = odf_create_heading(1, text=u'Filename') body.append(heading) text = u'The current file name is: ' paragraph = odf_create_paragraph(text, style=u"Standard") body.append(paragraph) paragraph._insert_between(odf_create_filename_variable(), u"The", u"is: ") # Save # ---- if not exists('test_output'): mkdir('test_output') document.save('test_output/use_case2.odt', pretty=True)