• DR-IT Software
  • Products
  • Documentation
  • Product page
  • Examples
  • API reference
  • Support
Show / Hide Table of Contents

Class UnitConverter

Represents a UnitConverter.

Inheritance
object
UnitConverter
Inherited Members
object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
Namespace: DRIT.Document.Office
Assembly: DRIT.Document.dll
Syntax
public static class UnitConverter

Fields

CentimeterPerInch

Gets centimeter per inch.

Declaration
public const double CentimeterPerInch = 2.54
Field Value
Type Description
double

DefaultDpi

Gets default dpi.

Declaration
public const int DefaultDpi = 96
Field Value
Type Description
int

MillimeterPerCentimeter

Gets millimeter per centimeter.

Declaration
public const double MillimeterPerCentimeter = 10
Field Value
Type Description
double

OpenXmlAngleConversionFactor

Gets open xml angle conversion factor.

Declaration
public const double OpenXmlAngleConversionFactor = 60000
Field Value
Type Description
double

PointPerPica

Gets point per pica.

Declaration
public const double PointPerPica = 12
Field Value
Type Description
double

TwipPerPoint

Gets twip per point.

Declaration
public const double TwipPerPoint = 20
Field Value
Type Description
double

Methods

CanConvert(MeasurementUnit, MeasurementUnit)

Provides the can Convert behavior for this object.

Declaration
public static bool CanConvert(MeasurementUnit from, MeasurementUnit to)
Parameters
Type Name Description
MeasurementUnit from

The from used by the operation.

MeasurementUnit to

The to used by the operation.

Returns
Type Description
bool

The resulting value.

Convert(MeasurementUnit, MeasurementUnit, double)

Provides the convert behavior for this object.

Declaration
public static double Convert(MeasurementUnit from, MeasurementUnit to, double value)
Parameters
Type Name Description
MeasurementUnit from

The from used by the operation.

MeasurementUnit to

The to used by the operation.

double value

The value to use for the operation.

Returns
Type Description
double

The resulting value.

Convert(MeasurementUnit, MeasurementUnit, double, UnitConversionOptions)

Provides the convert behavior for this object.

Declaration
public static double Convert(MeasurementUnit from, MeasurementUnit to, double value, UnitConversionOptions options)
Parameters
Type Name Description
MeasurementUnit from

The from used by the operation.

MeasurementUnit to

The to used by the operation.

double value

The value to use for the operation.

UnitConversionOptions options

Options that control the operation.

Returns
Type Description
double

The resulting value.

Convert(MeasurementUnit, MeasurementUnit, double, int)

Provides the convert behavior for this object.

Declaration
public static double Convert(MeasurementUnit from, MeasurementUnit to, double value, int dpi)
Parameters
Type Name Description
MeasurementUnit from

The from used by the operation.

MeasurementUnit to

The to used by the operation.

double value

The value to use for the operation.

int dpi

The dpi used by the operation.

Returns
Type Description
double

The resulting value.

FromHiMetricToPoint(double)

Provides the from Hi Metric To Point behavior for this object.

Declaration
public static double FromHiMetricToPoint(double himetricValue)
Parameters
Type Name Description
double himetricValue

The himetric Value used by the operation.

Returns
Type Description
double

The resulting value.

GetPointSizeWithWholePixels(double)

Represents a UnitConverter.

Declaration
public static double GetPointSizeWithWholePixels(double value)
Parameters
Type Name Description
double value
Returns
Type Description
double
Remarks

The font size in pixels should be a whole number. Therefore the point size 8 is changed to 8.25.

ToEmuFromInches(double)

Converts this object to emu From Inches.

Declaration
public static long ToEmuFromInches(double value)
Parameters
Type Name Description
double value

The value to use for the operation.

Returns
Type Description
long

The resulting value.

ToEmuFromPixel(double)

Converts this object to emu From Pixel.

Declaration
public static long ToEmuFromPixel(double value)
Parameters
Type Name Description
double value

The value to use for the operation.

Returns
Type Description
long

The resulting value.

ToEmuFromPixel(double, UnitConversionOptions)

Converts this object to emu From Pixel.

Declaration
public static long ToEmuFromPixel(double value, UnitConversionOptions options)
Parameters
Type Name Description
double value

The value to use for the operation.

UnitConversionOptions options

Options that control the operation.

Returns
Type Description
long

The resulting value.

ToEmuFromPixel(double, int)

Converts this object to emu From Pixel.

Declaration
public static long ToEmuFromPixel(double value, int dpi)
Parameters
Type Name Description
double value

The value to use for the operation.

int dpi

The dpi used by the operation.

Returns
Type Description
long

The resulting value.

ToEmuFromPixel(double?)

Converts this object to emu From Pixel.

Declaration
public static long? ToEmuFromPixel(double? value)
Parameters
Type Name Description
double? value

The value to use for the operation.

Returns
Type Description
long?

The resulting value.

ToEmuFromPixel(double?, UnitConversionOptions)

Converts this object to emu From Pixel.

Declaration
public static long? ToEmuFromPixel(double? value, UnitConversionOptions options)
Parameters
Type Name Description
double? value

The value to use for the operation.

UnitConversionOptions options

Options that control the operation.

Returns
Type Description
long?

The resulting value.

ToEmuFromPixel(double?, int)

Converts this object to emu From Pixel.

Declaration
public static long? ToEmuFromPixel(double? value, int dpi)
Parameters
Type Name Description
double? value

The value to use for the operation.

int dpi

The dpi used by the operation.

Returns
Type Description
long?

The resulting value.

ToEmuFromPoint(double)

Converts this object to emu From Point.

Declaration
public static long ToEmuFromPoint(double value)
Parameters
Type Name Description
double value

The value to use for the operation.

Returns
Type Description
long

The resulting value.

ToInchesFromEmu(long)

Converts this object to inches From Emu.

Declaration
public static double ToInchesFromEmu(long value)
Parameters
Type Name Description
long value

The value to use for the operation.

Returns
Type Description
double

The resulting value.

ToPixelFromEmu(double)

Converts this object to pixel From Emu.

Declaration
public static double ToPixelFromEmu(double value)
Parameters
Type Name Description
double value

The value to use for the operation.

Returns
Type Description
double

The resulting value.

ToPixelFromEmu(double, UnitConversionOptions)

Converts this object to pixel From Emu.

Declaration
public static double ToPixelFromEmu(double value, UnitConversionOptions options)
Parameters
Type Name Description
double value

The value to use for the operation.

UnitConversionOptions options

Options that control the operation.

Returns
Type Description
double

The resulting value.

ToPixelFromEmu(double, int)

Converts this object to pixel From Emu.

Declaration
public static double ToPixelFromEmu(double value, int dpi)
Parameters
Type Name Description
double value

The value to use for the operation.

int dpi

The dpi used by the operation.

Returns
Type Description
double

The resulting value.

ToPixelFromEmu(long)

Converts this object to pixel From Emu.

Declaration
public static double ToPixelFromEmu(long value)
Parameters
Type Name Description
long value

The value to use for the operation.

Returns
Type Description
double

The resulting value.

ToPixelFromEmu(long, UnitConversionOptions)

Converts this object to pixel From Emu.

Declaration
public static double ToPixelFromEmu(long value, UnitConversionOptions options)
Parameters
Type Name Description
long value

The value to use for the operation.

UnitConversionOptions options

Options that control the operation.

Returns
Type Description
double

The resulting value.

ToPixelFromEmu(long, int)

Converts this object to pixel From Emu.

Declaration
public static double ToPixelFromEmu(long value, int dpi)
Parameters
Type Name Description
long value

The value to use for the operation.

int dpi

The dpi used by the operation.

Returns
Type Description
double

The resulting value.

ToPixelFromEmu(long?)

Converts this object to pixel From Emu.

Declaration
public static double? ToPixelFromEmu(long? value)
Parameters
Type Name Description
long? value

The value to use for the operation.

Returns
Type Description
double?

The resulting value.

ToPixelFromEmu(long?, UnitConversionOptions)

Converts this object to pixel From Emu.

Declaration
public static double? ToPixelFromEmu(long? value, UnitConversionOptions options)
Parameters
Type Name Description
long? value

The value to use for the operation.

UnitConversionOptions options

Options that control the operation.

Returns
Type Description
double?

The resulting value.

ToPixelFromEmu(long?, int)

Converts this object to pixel From Emu.

Declaration
public static double? ToPixelFromEmu(long? value, int dpi)
Parameters
Type Name Description
long? value

The value to use for the operation.

int dpi

The dpi used by the operation.

Returns
Type Description
double?

The resulting value.

ToPixelFromPoint(double)

Converts this object to pixel From Point.

Declaration
public static double ToPixelFromPoint(double value)
Parameters
Type Name Description
double value

The value to use for the operation.

Returns
Type Description
double

The resulting value.

ToPixelFromPoint(double, UnitConversionOptions)

Converts this object to pixel From Point.

Declaration
public static double ToPixelFromPoint(double value, UnitConversionOptions options)
Parameters
Type Name Description
double value

The value to use for the operation.

UnitConversionOptions options

Options that control the operation.

Returns
Type Description
double

The resulting value.

ToPixelFromPoint(double, int)

Converts this object to pixel From Point.

Declaration
public static double ToPixelFromPoint(double value, int dpi)
Parameters
Type Name Description
double value

The value to use for the operation.

int dpi

The dpi used by the operation.

Returns
Type Description
double

The resulting value.

ToPixelsFromTwips(int)

Converts this object to pixels From Twips.

Declaration
public static double ToPixelsFromTwips(int twips)
Parameters
Type Name Description
int twips

The twips used by the operation.

Returns
Type Description
double

The resulting value.

ToPointFromEmu(double)

Converts this object to point From Emu.

Declaration
public static double ToPointFromEmu(double value)
Parameters
Type Name Description
double value

The value to use for the operation.

Returns
Type Description
double

The resulting value.

ToPointFromEmu(long)

Converts this object to point From Emu.

Declaration
public static double ToPointFromEmu(long value)
Parameters
Type Name Description
long value

The value to use for the operation.

Returns
Type Description
double

The resulting value.

ToPointFromPixel(double)

Converts this object to point From Pixel.

Declaration
public static double ToPointFromPixel(double value)
Parameters
Type Name Description
double value

The value to use for the operation.

Returns
Type Description
double

The resulting value.

ToPointFromPixel(double, UnitConversionOptions)

Converts this object to point From Pixel.

Declaration
public static double ToPointFromPixel(double value, UnitConversionOptions options)
Parameters
Type Name Description
double value

The value to use for the operation.

UnitConversionOptions options

Options that control the operation.

Returns
Type Description
double

The resulting value.

ToPointFromPixel(double, int)

Converts this object to point From Pixel.

Declaration
public static double ToPointFromPixel(double value, int dpi)
Parameters
Type Name Description
double value

The value to use for the operation.

int dpi

The dpi used by the operation.

Returns
Type Description
double

The resulting value.

ToPointFromTwips(int)

Converts this object to point From Twips.

Declaration
public static double ToPointFromTwips(int value)
Parameters
Type Name Description
int value
Returns
Type Description
double
Remarks

The font size in pixels should be a whole number. Therefore the point size 8 is changed to 8.25.

TryConvert(MeasurementUnit, MeasurementUnit, double, UnitConversionOptions, out double)

Attempts to convert and reports whether the operation succeeded.

Declaration
public static bool TryConvert(MeasurementUnit from, MeasurementUnit to, double value, UnitConversionOptions options, out double result)
Parameters
Type Name Description
MeasurementUnit from

The from used by the operation.

MeasurementUnit to

The to used by the operation.

double value

The value to use for the operation.

UnitConversionOptions options

Options that control the operation.

double result

The result used by the operation.

Returns
Type Description
bool

The resulting value.

TryConvert(MeasurementUnit, MeasurementUnit, double, out double)

Attempts to convert and reports whether the operation succeeded.

Declaration
public static bool TryConvert(MeasurementUnit from, MeasurementUnit to, double value, out double result)
Parameters
Type Name Description
MeasurementUnit from

The from used by the operation.

MeasurementUnit to

The to used by the operation.

double value

The value to use for the operation.

double result

The result used by the operation.

Returns
Type Description
bool

The resulting value.

TryConvert(MeasurementUnit, MeasurementUnit, double, int, out double)

Attempts to convert and reports whether the operation succeeded.

Declaration
public static bool TryConvert(MeasurementUnit from, MeasurementUnit to, double value, int dpi, out double result)
Parameters
Type Name Description
MeasurementUnit from

The from used by the operation.

MeasurementUnit to

The to used by the operation.

double value

The value to use for the operation.

int dpi

The dpi used by the operation.

double result

The result used by the operation.

Returns
Type Description
bool

The resulting value.

Back to top

DR-IT Software documentation

DR-IT Software · Products · Documentation index · Product page · Downloads · Support · Licensing

Generated by DocFX