Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Added font property to paragraph #417

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docx/oxml/text/parfmt.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ class CT_PPr(BaseOxmlElement):
spacing = ZeroOrOne('w:spacing', successors=_tag_seq[22:])
ind = ZeroOrOne('w:ind', successors=_tag_seq[23:])
jc = ZeroOrOne('w:jc', successors=_tag_seq[27:])
rPr = ZeroOrOne('w:rPr', successors=_tag_seq[34:])
sectPr = ZeroOrOne('w:sectPr', successors=_tag_seq[35:])
del _tag_seq

Expand Down
15 changes: 13 additions & 2 deletions docx/text/paragraph.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

from ..enum.style import WD_STYLE_TYPE
from .parfmt import ParagraphFormat
from .run import Run
from .run import Run, Font
from ..shared import Parented


Expand Down Expand Up @@ -83,7 +83,18 @@ def paragraph_format(self):
properties for this paragraph, such as line spacing and indentation.
"""
return ParagraphFormat(self._element)


@property
def font(self):
"""
The |Font| object providing access to the character formatting
properties for this paragraph, such as font name and size.
"""
pPr = self._element.pPr
if pPr is None:
return None
return Font(pPr)

@property
def runs(self):
"""
Expand Down