Interface IDocUnit
Assembly: IronPPT.dll
Syntax
public interface IDocUnit
When a position, size, or offset in a presentation has to be expressed in more than one measurement system, IDocUnit is the contract that holds the value and exposes it across units. The same underlying measurement is readable as Inch, CM, MM, Point, Twips, EMU (English Metric Units, PowerPoint's native integer unit), or Percentage, so a developer reads or writes whichever unit the surrounding code already uses without converting by hand. Each numeric property is nullable, so an unset unit stays absent rather than defaulting to zero.
The concrete implementors in IronPPT are DocUnit, the general-purpose measurement object used for element positions and dimensions, and FontSize, which specializes the contract for text sizing. Because both satisfy IDocUnit, code that lays out shapes and code that sizes runs can share the same unit-handling logic. A developer typically receives one of these from a layout or styling property rather than constructing it, then assigns the unit that matches the value at hand.
Working with the contract is a matter of setting one unit and reading another: assign Inch and read EMU, or set Point and read MM, letting the implementation handle the conversion. ToString returns a readable form of the held measurement, which is convenient for logging or diagnostics while positioning elements. Keep the nullable nature in mind, a property that was never set reads back as null rather than a converted zero.
IDocUnit width = new DocUnit();
width.Inch = 2.5;
long? emu = width.EMU;
double? mm = width.MM;
The slide element tutorial positions and sizes elements on a slide, the add shape example sets dimensions where these units apply, and the add image how-to places content using measured offsets.
Properties
CM
Declaration
Nullable<double> CM { get; set; }
Property Value
| Type |
Description |
| System.Nullable<System.Double> |
|
EMU
Declaration
Nullable<long> EMU { get; set; }
Property Value
| Type |
Description |
| System.Nullable<System.Int64> |
|
Inch
Declaration
Nullable<double> Inch { get; set; }
Property Value
| Type |
Description |
| System.Nullable<System.Double> |
|
MM
Declaration
Nullable<double> MM { get; set; }
Property Value
| Type |
Description |
| System.Nullable<System.Double> |
|
Percentage
Declaration
Percentage Percentage { get; set; }
Property Value
Point
Declaration
Nullable<double> Point { get; set; }
Property Value
| Type |
Description |
| System.Nullable<System.Double> |
|
Twips
Declaration
Nullable<double> Twips { get; set; }
Property Value
| Type |
Description |
| System.Nullable<System.Double> |
|
Methods
ToString()
Declaration
Returns
| Type |
Description |
| System.String |
|