def it_has_part_as_header_part(self): document = Document(dir_pkg_path) header = document.add_header() paragraph = header.add_paragraph() run = paragraph.add_run() run.add_floating_picture(python_powered_path) document.save('/home/daniel/faboozle.docx')
def it_adds_to_doc_without_header(self): document = Document(dir_pkg_path) header = document.add_header() header_elm_tag = 'w:headerReference' sentinel_sectPr = document._body._body.get_or_add_sectPr() header_elms = sentinel_sectPr.findall(qn(header_elm_tag)) assert len(header_elms) == 1 assert header assert len(header.paragraphs) == 0 header.add_paragraph('foobar') assert len(header.paragraphs) == 1