UNPKG

docxml

Version:

TypeScript (component) library for building and parsing a DOCX file

79 lines (78 loc) 2 kB
/** * An object that describes a size or length in various cross-computable units. Useful for telling the * library how centimeters you would like one thing to be, while the one thing is defined as twentieth- * points, EMU's or ostriches behind the scenes. * * See also the functions {@link cm}, {@link pt}, {@link hpt}, {@link twip} and {@link inch}. */ export declare type Length = { /** * Points. * * Defined as 1/72th of an inch. */ pt: number; /** * English metric units. * * Defined as 1/360000th of a centimeter. */ emu: number; /** * Half-points. * * Defined as 1/2nd of a point. */ hpt: number; /** * 1/8th points. * * Defined as 1/8th of a point. */ opt: number; /** * Twentieth of a point. Sometimes also called DXA. * * Defined as 1/20th of a point. */ twip: number; /** * Centimeters. */ cm: number; /** * Inch. * * Defined as exactly 2.54 centimeters. */ inch: number; }; /** * Converts points to any of the other units of length. */ export declare function pt(amount: number): Length; /** * Converts English metric units to any of the other units of length. */ export declare function emu(amount: number): Length; /** * Converts half-points to any of the other units of length. */ export declare function hpt(amount: number): Length; /** * Converts 8th-points to any of the other units of length. */ export declare function opt(amount: number): Length; /** * Converts twentieth-points to any of the other units of length. */ export declare function twip(amount: number): Length; /** * Converts centimeters to any of the other units of length. */ export declare function cm(amount: number): Length; /** * Converts inches to any of the other units of length. */ export declare function inch(amount: number): Length; export declare function convert(value: number, unit: string): Length;