openpyxl.utils.units module

openpyxl.utils.units.DEFAULT_HEADER = 0.3

From the ECMA Spec (4th Edition part 1) Page setup: “Left Page Margin in inches” p. 1647

Docs from http://startbigthinksmall.wordpress.com/2010/01/04/points-inches-and-emus-measuring-units-in-office-open-xml/

See also http://msdn.microsoft.com/en-us/library/dd560821(v=office.12).aspx

dxa: The main unit in OOXML is a twentieth of a point. Also called twips. pt: point. In Excel there are 72 points to an inch hp: half-points are used to specify font sizes. A font-size of 12pt equals 24 half points pct: Half-points are used to specify font sizes. A font-size of 12pt equals 24 half points

EMU: English Metric Unit, EMUs are used for coordinates in vector-based drawings and embedded pictures. One inch equates to 914400 EMUs and a centimeter is 360000. For bitmaps the default resolution is 96 dpi (known as PixelsPerInch in Excel). Spec p. 1122

For radial geometry Excel uses integert units of 1/60000th of a degree.

openpyxl.utils.units.EMU_to_cm(value)[源代码]
openpyxl.utils.units.EMU_to_inch(value)[源代码]
openpyxl.utils.units.EMU_to_pixels(value)[源代码]
openpyxl.utils.units.angle_to_degrees(value)[源代码]
openpyxl.utils.units.cm_to_EMU(value)[源代码]

1 cm = 360000 EMUs

openpyxl.utils.units.cm_to_dxa(value)[源代码]
openpyxl.utils.units.degrees_to_angle(value)[源代码]

1 degree = 60000 angles

openpyxl.utils.units.dxa_to_cm(value)[源代码]
openpyxl.utils.units.dxa_to_inch(value)[源代码]
openpyxl.utils.units.inch_to_EMU(value)[源代码]

1 inch = 914400 EMUs

openpyxl.utils.units.inch_to_dxa(value)[源代码]

1 inch = 72 * 20 dxa

openpyxl.utils.units.pixels_to_EMU(value)[源代码]

1 pixel = 9525 EMUs

openpyxl.utils.units.pixels_to_points(value, dpi=96)[源代码]

96 dpi, 72i

openpyxl.utils.units.points_to_pixels(value, dpi=96)[源代码]
openpyxl.utils.units.short_color(color)[源代码]

format a color to its short size