Package org.docx4j

Class UnitsOfMeasurement

java.lang.Object
org.docx4j.UnitsOfMeasurement

public class UnitsOfMeasurement extends Object
Author:
jharrop, azerolo
  • Field Details

    • format2DP

      public static final DecimalFormat format2DP
    • DPI

      public static final int DPI
  • Constructor Details

    • UnitsOfMeasurement

      public UnitsOfMeasurement()
  • Method Details

    • twipToEMU

      public static long twipToEMU(double twips)
    • inchToTwip

      public static int inchToTwip(float inch)
    • twipToInch

      public static float twipToInch(int twip)
    • twipToMm

      public static float twipToMm(int twip)
      Since:
      3.0.0
    • mmToTwip

      public static int mmToTwip(float mm)
    • twipToPoint

      public static float twipToPoint(int twip)
      Since:
      3.0.0
    • pointToTwip

      public static int pointToTwip(float point)
      Since:
      3.0.0
    • pxToTwip

      public static int pxToTwip(float px)
      Since:
      3.0.0
    • inchToTwipDouble

      public static double inchToTwipDouble(double inch)
      Convert an inches value to twips and return as a double.
    • pxToTwipDouble

      public static double pxToTwipDouble(double px)
      Convert a pixel value to twips and return as a double. This may be useful where the returned value will then be converted to another unit, and we don't want to lose precision due to rounding.
    • twipToBest

      public static String twipToBest(int leftL)
      1440 twip = 1 inch;Try to guess whether inches or mm looks nicer
      Parameters:
      left -
      Returns:
    • rgbTripleToHex

      public static String rgbTripleToHex(float red, float green, float blue)
    • toHexColor

      public static String toHexColor(int color)
      Since:
      3.0.0
    • combineColors

      public static int combineColors(int fgColor, int bgColor, int pctFg)
      Since:
      3.0.0