DOM.MeasurementUnits.DocumentUnit
Represents a document measurement value that can be expressed either as an absolute length stored internally in EMUs (English Metric Units) or as a relative.
This type is a convenience wrapper around a canonical internal representation (_value) stored as EMUs and a nullable. Read accessors convert the internal EMU value to the requested unit using the extension methods defined in. Writing a property will set the internal EMU value (and clear any percentage) or set the percentage (and clear the EMU value).
15 members
Constructors
DocumentUnit
DocumentUnit(double Value, Units unit)Initializes a newby converting the specified value from the given unit into the internal EMU representation.
Internally, all measurements are normalized to EMUs (English Metric Units) to ensure consistent sizing across document formats and conversions.
Parameters
- Value
- The numeric value expressed in the specified.
- unit
- The unit of measurement associated with(for example, points, pixels, inches, or centimeters).
Properties
Gets or sets the measurement expressed in centimeters.
Gets or sets the measurement expressed in EMUs (the internal storage unit).
Gets or sets the measurement expressed in inches.
Gets or sets the measurement expressed in millimeters.
Gets or sets the value as a. Setting this property makes the instance represent a relative value and clears any stored absolute EMU.
Gets or sets the measurement expressed in typographic points.
Gets or sets the measurement expressed in pixels.
The getter converts EMU → points and multiplies by 1.33 to approximate pixels. The setter converts the provided pixel value into EMU by first treating it as points.
Gets or sets the measurement expressed in twips (1/20 of a point).
Methods
op_Implicit
3 overloadsop_Implicit(System.Double)~DOM.MeasurementUnits.DocumentUnitImplicit conversion fromto. Treats the providedas points and stores the equivalent EMU value.
Parameters
- value
- Value in points.
op_Implicit(System.Int64)~DOM.MeasurementUnits.DocumentUnitImplicit conversion fromto. Treats the providedas an EMU value and stores it directly.
Parameters
- value
- Value in EMUs.
op_Implicit(DOM.MeasurementUnits.Percentage)~DOM.MeasurementUnits.DocumentUnitImplicit conversion fromto. The resulting instance will represent a relative value and havecleared.
Parameters
- value
- Percentage to convert.
ToString
ToStringReturns a string representation of the unit.
Returns
The raw EMU value when present, otherwise the percentage string when present, otherwise an empty string.
Fields
Internal relative measurement when the unit represents a percentage of some reference. When non-null this value is authoritative andwill be null.
Internal absolute value stored in EMUs. When non-null this value is the authoritative absolute measurement for the instance.