下划线
=========
Underline
.. tab:: 中文
Word 文档中的文本可以采用多种样式加下划线。
.. tab:: 英文
Text in a Word document can be underlined in a variety of styles.
协议
--------
Protocol
.. tab:: 中文
下划线的调用协议被重载,使得它像 ``.bold`` 和 ``.italic`` 一样支持单一的下划线,同时也允许赋值枚举值来指定更复杂的下划线样式,例如虚线、波浪线和双下划线::
>>> run = paragraph.add_run()
>>> run.underline
None
>>> run.underline = True
>>> run.underline
True
>>> run.underline = WD_UNDERLINE.SINGLE
>>> run.underline
True
>>> run.underline = WD_UNDERLINE.DOUBLE
>>> str(run.underline)
DOUBLE (3)
>>> run.underline = False
>>> run.underline
False
>>> run.underline = WD_UNDERLINE.NONE
>>> run.underline
False
>>> run.underline = None
>>> run.underline
None
.. tab:: 英文
The call protocol for underline is overloaded such that it works like
``.bold`` and ``.italic`` for single underline, but also allows an enumerated
value to be assigned to specify more sophisticated underlining such as
dashed, wavy, and double-underline::
>>> run = paragraph.add_run()
>>> run.underline
None
>>> run.underline = True
>>> run.underline
True
>>> run.underline = WD_UNDERLINE.SINGLE
>>> run.underline
True
>>> run.underline = WD_UNDERLINE.DOUBLE
>>> str(run.underline)
DOUBLE (3)
>>> run.underline = False
>>> run.underline
False
>>> run.underline = WD_UNDERLINE.NONE
>>> run.underline
False
>>> run.underline = None
>>> run.underline
None
枚举
------------
Enumerations
.. tab:: 中文
.. tab:: 英文
* `WdUnderline Enumeration on MSDN`_
.. _WdUnderline Enumeration on MSDN:
http://msdn.microsoft.com/en-us/library/office/ff822388(v=office.15).aspx
样本 XML
------------
Specimen XML
.. highlight:: xml
.. tab:: 中文
基线运行::
下划线由继承决定
单一下划线::
单一下划线
双下划线::
双下划线
直接应用无下划线,覆盖继承值::
无下划线
.. tab:: 英文
Baseline run::
underlining determined by inheritance
Single underline::
single underlined
Double underline::
single underlined
Directly-applied no-underline, overrides inherited value::
not underlined
架构摘录
--------------
Schema excerpt
.. tab:: 中文
请注意, ``CT_Underline`` 上的 ``w:val`` 属性是可选的。如果不存在,则运行时不会出现下划线。
.. tab:: 英文
Note that the ``w:val`` attribute on ``CT_Underline`` is optional. When it is
not present no underline appears on the run.
.. highlight:: xml
::