Package org.docx4j
Class UnitsOfMeasurement
java.lang.Object
org.docx4j.UnitsOfMeasurement
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final DecimalFormatprivate static final org.slf4j.Logger -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate StringcalcHexColor(int value) static intcombineColors(int fgColor, int bgColor, int pctFg) private static StringgetHex(float f) static intinchToTwip(float inch) static doubleinchToTwipDouble(double inch) Convert an inches value to twips and return as a double.static intmmToTwip(float mm) static intpointToTwip(float point) static intpxToTwip(float px) static doublepxToTwipDouble(double px) Convert a pixel value to twips and return as a double.static StringrgbTripleToHex(float red, float green, float blue) static StringtoHexColor(int color) static StringtwipToBest(int leftL) 1440 twip = 1 inch;Try to guess whether inches or mm looks nicerstatic longtwipToEMU(double twips) static floattwipToInch(int twip) static floattwipToMm(int twip) static floattwipToPoint(int twip)
-
Field Details
-
log
private static final org.slf4j.Logger log -
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
1440 twip = 1 inch;Try to guess whether inches or mm looks nicer- Parameters:
left-- Returns:
-
rgbTripleToHex
-
getHex
-
toHexColor
- Since:
- 3.0.0
-
combineColors
public static int combineColors(int fgColor, int bgColor, int pctFg) - Since:
- 3.0.0
-
calcHexColor
-