Skip to content

Commit 68a28ab

Browse files
committed
hdr: add Section.first_page_footer
1 parent 3ac49e5 commit 68a28ab

File tree

3 files changed

+23
-1
lines changed

3 files changed

+23
-1
lines changed

docx/section.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,15 @@ def even_page_header(self):
9292
"""
9393
return _Header(self._sectPr, self._document_part, WD_HEADER_FOOTER.EVEN_PAGE)
9494

95+
@property
96+
def first_page_footer(self):
97+
"""|_Footer| object defining footer content for the first page of this section.
98+
99+
The content of this footer definition is ignored unless the property
100+
:attr:`.different_first_page_header_footer` is set True.
101+
"""
102+
return _Footer(self._sectPr, self._document_part, WD_HEADER_FOOTER.FIRST_PAGE)
103+
95104
@lazyproperty
96105
def footer(self):
97106
"""|_Footer| object representing default page footer for this section.

features/sct-section.feature

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ Feature: Access and change section properties
3737
Then section.even_page_header is a _Header object
3838

3939

40-
@wip
4140
Scenario: Section.first_page_footer
4241
Given a Section object as section
4342
Then section.first_page_footer is a _Footer object

tests/test_section.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,20 @@ def it_provides_access_to_its_even_page_header(
140140
)
141141
assert header is header_
142142

143+
def it_provides_access_to_its_first_page_footer(
144+
self, document_part_, _Footer_, footer_
145+
):
146+
sectPr = element("w:sectPr")
147+
_Footer_.return_value = footer_
148+
section = Section(sectPr, document_part_)
149+
150+
footer = section.first_page_footer
151+
152+
_Footer_.assert_called_once_with(
153+
sectPr, document_part_, WD_HEADER_FOOTER.FIRST_PAGE
154+
)
155+
assert footer is footer_
156+
143157
def it_provides_access_to_its_default_footer(
144158
self, document_part_, _Footer_, footer_
145159
):

0 commit comments

Comments
 (0)