Package io.keikai.range.impl.imexp
Class UnitUtil
- java.lang.Object
-
- io.keikai.range.impl.imexp.UnitUtil
-
public class UnitUtil extends Object
Various unit conversion methods.- Since:
- 3.5.0
- Author:
- Hawk
-
-
Constructor Summary
Constructors Constructor Description UnitUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static doublecmToInche(double cm)static intcmToPx(double cm)static intdefaultColumnWidthToPx(int columnWidth, int charWidth)Convert default columns width (in character) to pixel.static intemuToPx(int emu)convert EMU to pixel, 1 twip == 635 emustatic intfileChar256ToPx(int char256, int charWidth)convert file 1/256 character width to pixelstatic byte[]hexToArgbColor(String color)static doubleincheToCm(double inches)static intincheToPx(double inches)static intpointToPx(int point)convert point to pixelstatic doublepxToCm(int px)static doublepxToCTChar(int px, int charWidth)static intpxToDefaultColumnWidth(int px, int charWidth)Convert default column width in pixel to number of character by reverse defaultColumnWidthToPx() and ignore the mod(%) operation.static intpxToEmu(int px)convert pixel to EMUstatic intpxToFileChar256(int px, int charWidth)convert pixel to file 1/256 character widthstatic doublepxToInche(int px)static intpxToPoint(int px)convert pixel to pointstatic intpxToTwip(int px)convert pixel to twip (1/20 point)static inttwipToPx(int twip)convert twip (1/20 point) to pixelstatic intxssfDefaultColumnWidthToPx(double xssfDefaultColumnWidth, int charWidth)Convert XSSF default columns width (in character) to pixel.
-
-
-
Method Detail
-
pxToPoint
public static int pxToPoint(int px)
convert pixel to point
-
pointToPx
public static int pointToPx(int point)
convert point to pixel
-
pxToEmu
public static int pxToEmu(int px)
convert pixel to EMU
-
emuToPx
public static int emuToPx(int emu)
convert EMU to pixel, 1 twip == 635 emu
-
twipToPx
public static int twipToPx(int twip)
convert twip (1/20 point) to pixel
-
pxToTwip
public static int pxToTwip(int px)
convert pixel to twip (1/20 point)
-
fileChar256ToPx
public static int fileChar256ToPx(int char256, int charWidth)convert file 1/256 character width to pixel
-
pxToFileChar256
public static int pxToFileChar256(int px, int charWidth)convert pixel to file 1/256 character width
-
defaultColumnWidthToPx
public static int defaultColumnWidthToPx(int columnWidth, int charWidth)Convert default columns width (in character) to pixel. 5 pixels are margin padding.(There are 4 pixels of margin padding (two on each side), plus 1 pixel padding for the gridlines.) Description of how column widths are determined in Excel (http://support.microsoft.com/kb/214123)- Parameters:
columnWidth- number of charactercharWidth- Using the Calibri font, the maximum digit width of 11 point font size is 7 pixels (at 96 dpi).- Returns:
- width in pixel Rounds this number up to the nearest multiple of 8 pixels.
-
pxToDefaultColumnWidth
public static int pxToDefaultColumnWidth(int px, int charWidth)Convert default column width in pixel to number of character by reverse defaultColumnWidthToPx() and ignore the mod(%) operation.- Parameters:
px- default column width in pixelcharWidth- one character width in pixel of normal style's font- Returns:
- default column width in character
-
incheToPx
public static int incheToPx(double inches)
-
pxToInche
public static double pxToInche(int px)
-
pxToCTChar
public static double pxToCTChar(int px, int charWidth)
-
cmToInche
public static double cmToInche(double cm)
-
incheToCm
public static double incheToCm(double inches)
-
cmToPx
public static int cmToPx(double cm)
-
pxToCm
public static double pxToCm(int px)
-
xssfDefaultColumnWidthToPx
public static int xssfDefaultColumnWidthToPx(double xssfDefaultColumnWidth, int charWidth)Convert XSSF default columns width (in character) to pixel. In XSSF the value is a double value / charWidth and includes the 5 pixels margin padding. 5 pixels are margin padding.(There are 4 pixels of margin padding (two on each side), plus 1 pixel padding for the gridlines.) Description of how column widths are determined in Excel (http://support.microsoft.com/kb/214123)- Parameters:
columnWidth- number of charactercharWidth- Using the Calibri font, the maximum digit width of 11 point font size is 7 pixels (at 96 dpi).- Returns:
- width in pixel
-
hexToArgbColor
public static byte[] hexToArgbColor(String color)
-
-