File: shared.rst

package info (click to toggle)
python-docx 1.1.2%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 6,904 kB
  • sloc: xml: 25,311; python: 23,028; makefile: 176
file content (59 lines) | stat: -rw-r--r-- 1,174 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59

.. _shared_api:

Shared classes
==============

.. currentmodule:: docx.shared


Length objects
--------------

Length values in |docx| are expressed as a standardized |Length| value object.
|Length| is a subclass of |int|, having all the behavior of an |int|. In
addition, it has built-in units conversion properties, e.g.::

    >>> inline_shape.height
    914400
    >>> inline_shape.height.inches
    1.0

Length objects are constructed using a selection of convenience constructors,
allowing values to be expressed in the units most appropriate to the context.

.. autoclass:: Length
   :members:
   :member-order: bysource

.. autoclass:: Inches
   :members:

.. autoclass:: Cm
   :members:

.. autoclass:: Mm
   :members:

.. autoclass:: Pt
   :members:

.. autoclass:: Twips
   :members:

.. autoclass:: Emu
   :members:


|RGBColor| objects
------------------

.. autoclass:: RGBColor(r, g, b)
   :members:
   :undoc-members:

   `r`, `g`, and `b` are each an integer in the range 0-255 inclusive. Using
   the hexidecimal integer notation, e.g. `0x42` may enhance readability
   where hex RGB values are in use::

       >>> lavender = RGBColor(0xff, 0x99, 0xcc)