# openpyxl.utils.units module

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

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 integer units of 1/60000th of a degree.

openpyxl.utils.units.EMU_to_cm(value)[source]
openpyxl.utils.units.EMU_to_inch(value)[source]
openpyxl.utils.units.EMU_to_pixels(value)[source]
openpyxl.utils.units.angle_to_degrees(value)[source]
openpyxl.utils.units.cm_to_EMU(value)[source]

1 cm = 360000 EMUs

openpyxl.utils.units.cm_to_dxa(value)[source]
openpyxl.utils.units.degrees_to_angle(value)[source]

1 degree = 60000 angles

openpyxl.utils.units.dxa_to_cm(value)[source]
openpyxl.utils.units.dxa_to_inch(value)[source]
openpyxl.utils.units.inch_to_EMU(value)[source]

1 inch = 914400 EMUs

openpyxl.utils.units.inch_to_dxa(value)[source]

1 inch = 72 * 20 dxa

openpyxl.utils.units.pixels_to_EMU(value)[source]

1 pixel = 9525 EMUs

openpyxl.utils.units.pixels_to_points(value, dpi=96)[source]

96 dpi, 72i

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

format a color to its short size