def test_suppress_numbering_true(self): h = Heading('text') h.suppress_numbering = True self.assertTrue(h.suppress_numbering)
def test_suppress_numbering_false(self): h = Heading('text') h.suppress_numbering = False self.assertFalse(h.suppress_numbering)
def test_restart_numbering_true(self): h = Heading('text') h.restart_numbering = False self.assertFalse(h.restart_numbering)
def test_unset_suppress_numbering(self): h = Heading('text') self.assertFalse(h.suppress_numbering)
#!/usr/bin/env python #coding:utf-8 # Purpose: # Created: 10.04.12 # Copyright (C) 2012, Manfred Moitzi # License: MIT license import ezodf from ezodf.text import Paragraph, Heading from ezodf.whitespaces import SoftPageBreak name = 'pageBreakText.odt' odt = ezodf.newdoc(doctype=name[-3:], filename=name) odt.body.append(Heading("Page Break test")) odt.body.append(Paragraph("This is the first page")) # does not work with LibO/OOo odt.body.append(SoftPageBreak()) odt.body.append(Paragraph("This is the second page")) odt.save()
def test_unset_restart_numbering(self): h = Heading('text') self.assertFalse(h.restart_numbering)
def test_init_xmlroot(self): node = etree.Element(CN('text:h'), test="heading") h = Heading(xmlnode=node) self.assertTrue(isinstance(h, GenericWrapper)) self.assertEqual(h.xmlnode.tag, CN('text:h')) self.assertEqual(h.xmlnode.get('test'), "heading")
def test_heading_content(self): np = NumberedParagraph(Heading('text')) res = np.content self.assertEqual(res.plaintext(), 'text')
def test_bare_init(self): h = Heading() self.assertTrue(isinstance(h, GenericWrapper)) self.assertEqual(h.xmlnode.tag, CN('text:h'))
def test_restart_numbering_true(self): h = Heading("text") h.restart_numbering = True self.assertTrue(h.restart_numbering)
def test_outline_level_2(self): h = Heading("text") h.outline_level = 2.0 self.assertEqual(h.outline_level, 2)
#!/usr/bin/env python #coding:utf-8 # Purpose: create simple text document # Created: 06.01.2011 # Copyright (C) 2011, Manfred Moitzi # License: MIT license from __future__ import unicode_literals, print_function, division __author__ = "mozman <*****@*****.**>" import ezodf from ezodf.text import Paragraph, Heading P1 = "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet." P2 = "Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat." P3 = "Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi." P4 = "Nam liber tempor cum soluta nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer" name = 'simple_text_document.odt' odt = ezodf.newdoc(doctype=name[-3:], filename=name) odt.body.append(Heading("A Simple Test Document")) for nr, p in enumerate((P1, P2, P3, P4)): cnr = nr + 1 odt.body.append(Heading("Chapter %d" % cnr, cnr)) odt.body.append(Paragraph(p)) odt.save()
def test_outline_level_2(self): h = Heading('text') h.outline_level = 2. self.assertEqual(h.outline_level, 2)
def test_outline_level_1(self): h = Heading('text') self.assertEqual(h.outline_level, 1)
# Purpose: create simple text document # Created: 06.01.2011 # Copyright (C) 2011, Manfred Moitzi # License: MIT license from __future__ import unicode_literals, print_function, division __author__ = "mozman <*****@*****.**>" import ezodf from ezodf.text import Paragraph, Heading, Section P1 = "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet." P2 = "Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat." P3 = "Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi." P4 = "Nam liber tempor cum soluta nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer" name = 'protected_paragraph.odt' odt = ezodf.newdoc(doctype=name[-3:], filename=name) odt.body.append(Heading("A Simple Test Document")) for nr, p in enumerate((P1, P2, P3, P4)): cnr = nr + 1 if cnr != 2: odt.body.append(Heading("Chapter %d" % cnr, cnr)) odt.body.append(Paragraph(p)) else: section = odt.body.append(Section(name='p1')) section.append(Heading("The write-protected paragraph")) section.append(Paragraph(p)) section.protected = True odt.save()