Skip to content

Commit fc965c2

Browse files
author
Steve Canny
committed
docs: add docs for WD_UNDERLINE enumeration
1 parent 9fa9d0a commit fc965c2

File tree

6 files changed

+99
-11
lines changed

6 files changed

+99
-11
lines changed

docs/api/enum/WdUnderline.rst

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
.. _WdUnderline:
2+
3+
``WD_UNDERLINE``
4+
================
5+
6+
Specifies the style of underline applied to a run of characters.
7+
8+
----
9+
10+
NONE
11+
No underline. This setting overrides any inherited underline value, so can
12+
be used to remove underline from a run that inherits underlining from its
13+
containing paragraph. Note this is not the same as assigning |None| to
14+
Run.underline. |None| is a valid assignment value, but causes the run to
15+
inherit its underline value. Assigning ``WD_UNDERLINE.NONE`` causes
16+
underlining to be unconditionally turned off.
17+
18+
SINGLE
19+
A single line. Note that this setting is write-only in the sense that
20+
|True| (rather than ``WD_UNDERLINE.SINGLE``) is returned for a run having
21+
this setting.
22+
23+
WORDS
24+
Underline individual words only.
25+
26+
DOUBLE
27+
A double line.
28+
29+
DOTTED
30+
Dots.
31+
32+
THICK
33+
A single thick line.
34+
35+
DASH
36+
Dashes.
37+
38+
DOT_DASH
39+
Alternating dots and dashes.
40+
41+
DOT_DOT_DASH
42+
An alternating dot-dot-dash pattern.
43+
44+
WAVY
45+
A single wavy line.
46+
47+
DOTTED_HEAVY
48+
Heavy dots.
49+
50+
DASH_HEAVY
51+
Heavy dashes.
52+
53+
DOT_DASH_HEAVY
54+
Alternating heavy dots and heavy dashes.
55+
56+
DOT_DOT_DASH_HEAVY
57+
An alternating heavy dot-dot-dash pattern.
58+
59+
WAVY_HEAVY
60+
A heavy wavy line.
61+
62+
DASH_LONG
63+
Long dashes.
64+
65+
WAVY_DOUBLE
66+
A double wavy line.
67+
68+
DASH_LONG_HEAVY
69+
Long heavy dashes.

docs/api/enum/index.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
2+
Enumerations
3+
============
4+
5+
Documentation for the various enumerations used for |docx| property settings
6+
can be found here:
7+
8+
.. toctree::
9+
:titlesonly:
10+
11+
WdUnderline

docs/dev/analysis/features/underline.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,9 @@ Directly-applied no-underline, overrides inherited value::
8787
Schema excerpt
8888
--------------
8989

90+
Note that the ``w:val`` attribute on ``CT_Underline`` is optional. When it is
91+
not present no underline appears on the run.
92+
9093
.. highlight:: xml
9194

9295
::

docs/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ API Documentation
8484
api/text
8585
api/shape
8686
api/shared
87+
api/enum/index
8788

8889

8990
Contributor Guide

docx/enum/text.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,15 @@ class WD_UNDERLINE(XmlEnumeration):
4747
'NONE', 0, 'none', 'No underline. This setting overrides any inh'
4848
'erited underline value, so can be used to remove underline from'
4949
' a run that inherits underlining from its containing paragraph.'
50+
' Note this is not the same as assigning |None| to Run.underline'
51+
'. |None| is a valid assignment value, but causes the run to inh'
52+
'erit its underline value. Assigning ``WD_UNDERLINE.NONE`` cause'
53+
's underlining to be unconditionally turned off.'
5054
),
5155
XmlMappedEnumMember(
52-
'SINGLE', 1, 'single', 'A single line (default). Note that this '
53-
'setting is write-only in the sense that |True| (rather than 1) '
54-
'is returned for a run having this setting.'
56+
'SINGLE', 1, 'single', 'A single line. Note that this setting is'
57+
'write-only in the sense that |True| (rather than ``WD_UNDERLINE'
58+
'.SINGLE``) is returned for a run having this setting.'
5559
),
5660
XmlMappedEnumMember(
5761
'WORDS', 2, 'words', 'Underline individual words only.'

docx/text.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -333,14 +333,14 @@ def text(self):
333333
def underline(self):
334334
"""
335335
The underline style for this |Run|, one of |None|, |True|, |False|,
336-
or a value from ``pptx.enum.text.WD_UNDERLINE``. A value of |None|
337-
indicates the run has no directly-applied underline value and so will
338-
inherit the underline value of its containing paragraph. Assigning
339-
|None| to this property removes any directly-applied underline value.
340-
A value of |False| indicates a directly-applied setting of no
341-
underline, overriding any inherited value. A value of |True|
342-
indicates single underline. The values from ``WD_UNDERLINE`` are used
343-
to specify other outline styles such as double, wavy, and dotted.
336+
or a value from :ref:`WdUnderline`. A value of |None| indicates the
337+
run has no directly-applied underline value and so will inherit the
338+
underline value of its containing paragraph. Assigning |None| to this
339+
property removes any directly-applied underline value. A value of
340+
|False| indicates a directly-applied setting of no underline,
341+
overriding any inherited value. A value of |True| indicates single
342+
underline. The values from ``WD_UNDERLINE`` are used to specify other
343+
outline styles such as double, wavy, and dotted.
344344
"""
345345
return self._r.underline
346346

0 commit comments

Comments
 (0)