New to Telerik Document Processing? Download free 30-day trial

Device Independent Pixels

Device Independent Pixels (DIPs) is a unit type used in the Document Processing libraries in the following cases:

UnitHelper class

The UnitHelper class provides a bunch of methods for converting from DIPs to other measurement units and vice versa (e.g. points, picas, centimeters, inches, etc.).

Convert From Dip to Unit:

  • DipToPoint: Converts dips to points.
  • DipToPointI: Converts dips to points.
  • DipToPica: Converts dips to picas.
  • DipToCm: Converts dips to centimeters.
  • DipToMm: Converts dips to millimeters.
  • DipToInch: Converts dips to inches.
  • DipToTwip: Converts dips to twips.
  • DipToEmu: Converts dips to EMUs.
  • DipToTwipI: Converts dips to twips.
  • DipToTwipF: Converts dips to twips.
  • DipToUnit: Converts DIPs to units.

Convert From Unit to Dip:

  • PointToDip: Converts points to dips.
  • PicaToDip: Converts picas to dips.
  • EmuToDip: Converts EMUs to dips.
  • CmToDip: Converts centimeters to dips.
  • MmToDip: Converts millimeters to dips.
  • InchToDip: Converts inches to dips.
  • TwipToDip: Converts twips to dips.
  • TwipToDipF: Converts twips to dips.
  • TwipToDipI: Converts twips to dips.
  • UnitToDip: Converts Units to dips.

Most of the methods follow the same pattern for converting units:

Example 1 shows how to obtain row height as DIPs and convert it to Points.

Example 1: Convert from DIP to Point

var rowHeightInDips = worksheet.Rows[0].GetHeight().Value.Value; 
var rowHeightInPoints = UnitHelper.DipToPoint(rowHeightInDips); 
except the DipToUnit and UnitToDip methods which accepts not only the units but the UnitType as well as a parameter:

Example 2 shows how to convert from Point to DIP and set the row height.

Example 2: Convert from Point to DIP

double dips = UnitHelper.UnitToDip(60, UnitType.Point); 
RowHeight newRowHeight = new RowHeight(dips, isCustom: true); 
worksheet.Rows[0].SetHeight(newRowHeight); 
In this article