VDocs.NET
Back to DOM

DOM.MeasurementUnits.DocumentUnit

Namespace: DOM.MeasurementUnits

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

CM

Gets or sets the measurement expressed in centimeters.

EMU

Gets or sets the measurement expressed in EMUs (the internal storage unit).

Inch

Gets or sets the measurement expressed in inches.

MM

Gets or sets the measurement expressed in millimeters.

Percentage

Gets or sets the value as a. Setting this property makes the instance represent a relative value and clears any stored absolute EMU.

Point

Gets or sets the measurement expressed in typographic points.

PX

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.

Twips

Gets or sets the measurement expressed in twips (1/20 of a point).

Methods

op_Implicit

3 overloads
op_Implicit(System.Double)~DOM.MeasurementUnits.DocumentUnit

Implicit conversion fromto. Treats the providedas points and stores the equivalent EMU value.

Parameters

value
Value in points.
op_Implicit(System.Int64)~DOM.MeasurementUnits.DocumentUnit

Implicit conversion fromto. Treats the providedas an EMU value and stores it directly.

Parameters

value
Value in EMUs.
op_Implicit(DOM.MeasurementUnits.Percentage)~DOM.MeasurementUnits.DocumentUnit

Implicit conversion fromto. The resulting instance will represent a relative value and havecleared.

Parameters

value
Percentage to convert.

ToString

ToString

Returns a string representation of the unit.

Returns

The raw EMU value when present, otherwise the percentage string when present, otherwise an empty string.

Fields

_percentage

Internal relative measurement when the unit represents a percentage of some reference. When non-null this value is authoritative andwill be null.

_value

Internal absolute value stored in EMUs. When non-null this value is the authoritative absolute measurement for the instance.

VDocs.NET
The .NET Word Document Library

Generate Word
documents.
Not XML.

Create professional documents in .NET without the complexity of OpenXML or Word Interop.

Reset Password

Enter your email and we'll send you a link to reset your password.

Remember your password? Sign in