Class UnitHelper
Converts between device-independent pixels (dips) and various measurement units (points, picas, inches, centimeters, twips, EMUs) for layout and sizing.
Inheritance
Inherited Members
Namespace: Telerik.Windows.Documents.Spreadsheet.Utilities
Assembly: Telerik.Windows.Documents.Spreadsheet.dll
Syntax
public static class UnitHelper
Methods
CmToDip(Double)
Converts centimeters to dips using the 96 DPI standard (1 inch = 2.54 cm).
Declaration
public static double CmToDip(double value)
Parameters
|
System.Double
value
Centimeters. |
Returns
|
System.Double
Pixels. |
DipToCm(Double)
Converts dips to centimeters using the 96 DPI standard (1 inch = 2.54 cm).
Declaration
public static double DipToCm(double value)
Parameters
|
System.Double
value
Pixels. |
Returns
|
System.Double
Centimeters. |
DipToEmu(Double)
Converts dips to English Metric Units (EMUs) used in Office Open XML (1 EMU = 1/914400 inch).
Declaration
public static double DipToEmu(double value)
Parameters
|
System.Double
value
Dips. |
Returns
|
System.Double
EMUs. |
DipToInch(Double)
Converts dips to inches using the 96 DPI standard (96 dips = 1 inch).
Declaration
public static double DipToInch(double value)
Parameters
|
System.Double
value
Pixels. |
Returns
|
System.Double
Inches. |
DipToMm(Double)
Converts dips to millimeters using the 96 DPI standard (1 cm = 10 mm).
Declaration
public static double DipToMm(double value)
Parameters
|
System.Double
value
Pixels. |
Returns
|
System.Double
Millimeters. |
DipToPica(Double)
Converts dips to picas using the 96 DPI standard (1 pica = 1/6 inch = 12 points).
Declaration
public static double DipToPica(double value)
Parameters
|
System.Double
value
Pixels. |
Returns
|
System.Double
Picas. |
DipToPoint(Double)
Converts dips to points using the 96 DPI standard (1 inch = 72 points).
Declaration
public static double DipToPoint(double value)
Parameters
|
System.Double
value
Pixels. |
Returns
|
System.Double
Points. |
DipToPointI(Double)
Converts dips to points and rounds to the nearest integer.
Declaration
public static int DipToPointI(double value)
Parameters
|
System.Double
value
Pixels. |
Returns
|
System.Int32
Points. |
DipToTwip(Double)
Converts dips to twips using the 96 DPI standard (1 twip = 1/1440 inch = 1/20 point).
Declaration
public static double DipToTwip(double value)
Parameters
|
System.Double
value
Pixels. |
Returns
|
System.Double
Twips. |
DipToTwipF(Double)
Converts dips to twips and returns as a single-precision float.
Declaration
public static float DipToTwipF(double value)
Parameters
|
System.Double
value
Pixels. |
Returns
|
System.Single
Twips. |
DipToTwipI(Double)
Converts dips to twips and rounds to the nearest integer.
Declaration
public static int DipToTwipI(double value)
Parameters
|
System.Double
value
Pixels. |
Returns
|
System.Int32
Twips. |
DipToUnit(Double, UnitType)
Converts dips to the specified unit type, dispatching to the appropriate conversion method.
Declaration
public static double DipToUnit(double value, UnitType type)
Parameters
|
System.Double
value
Pixels. |
|
UnitType
type
Unit type. |
Returns
|
System.Double
Units. |
EmuToDip(Double)
Converts English Metric Units (EMUs) to dips using the 96 DPI standard (1 EMU = 1/914400 inch).
Declaration
public static double EmuToDip(double value)
Parameters
|
System.Double
value
EMUs. |
Returns
|
System.Double
Pixels. |
ExcelColumnWidthToPixelWidth(Workbook, Double)
Converts Excel's character-based column width units to pixel width, based on the Normal style's maximum digit width.
Declaration
public static double ExcelColumnWidthToPixelWidth(Workbook workbook, double width)
Parameters
|
Workbook
workbook
The workbook. |
|
System.Double
width
The width. |
Returns
|
System.Double
|
InchToDip(Double)
Converts inches to dips using the 96 DPI standard (96 dips = 1 inch).
Declaration
public static double InchToDip(double value)
Parameters
|
System.Double
value
Inches. |
Returns
|
System.Double
Pixels. |
MmToDip(Double)
Converts millimeters to dips using the 96 DPI standard (1 cm = 10 mm).
Declaration
public static double MmToDip(double value)
Parameters
|
System.Double
value
Millimeteres. |
Returns
|
System.Double
Pixels. |
PicaToDip(Double)
Converts picas to dips using the 96 DPI standard (1 pica = 1/6 inch = 12 points).
Declaration
public static double PicaToDip(double value)
Parameters
|
System.Double
value
Picas. |
Returns
|
System.Double
Pixels. |
PixelWidthToExcelColumnWidth(Workbook, Double)
Converts pixel width to Excel's character-based column width units, based on the Normal style's maximum digit width.
Declaration
public static double PixelWidthToExcelColumnWidth(Workbook workbook, double pixels)
Parameters
|
Workbook
workbook
The workbook. |
|
System.Double
pixels
The pixels. |
Returns
|
System.Double
|
PointToDip(Double)
Converts points to dips using the 96 DPI standard (1 inch = 72 points).
Declaration
public static double PointToDip(double value)
Parameters
|
System.Double
value
Points. |
Returns
|
System.Double
Pixels. |
TwipToDip(Double)
Converts twips to dips using the 96 DPI standard (1 twip = 1/1440 inch = 1/20 point).
Declaration
public static double TwipToDip(double value)
Parameters
|
System.Double
value
Twips. |
Returns
|
System.Double
Pixels. |
TwipToDipF(Double)
Converts twips to dips and returns as a single-precision float.
Declaration
public static float TwipToDipF(double value)
Parameters
|
System.Double
value
Twips. |
Returns
|
System.Single
Dips. |
TwipToDipI(Double)
Converts twips to dips and truncates to an integer.
Declaration
public static int TwipToDipI(double value)
Parameters
|
System.Double
value
Twips. |
Returns
|
System.Int32
Dips. |
UnitToDip(Double, UnitType)
Converts the specified unit type to dips, dispatching to the appropriate conversion method.
Declaration
public static double UnitToDip(double value, UnitType type)
Parameters
|
System.Double
value
Units. |
|
UnitType
type
Unit type. |
Returns
|
System.Double
Pixels. |