/** * @since 3.0.0 */ public static int pxToTwip(float px) { float inch = px/DPI; return inchToTwip(inch); }
public static int mmToTwip(float mm ) { float inch = mm*0.0394f; return inchToTwip(inch); }
public SpaceBefore(CSSValue value) { debug(CSS_NAME, value); CSSPrimitiveValue cssPrimitiveValue = (CSSPrimitiveValue)value; short ignored = 1; float fVal = cssPrimitiveValue.getFloatValue(ignored); // unit type ignored in cssparser int twip; short type = cssPrimitiveValue.getPrimitiveType(); if (CSSPrimitiveValue.CSS_IN == type) { twip = UnitsOfMeasurement.inchToTwip(fVal); } else if (CSSPrimitiveValue.CSS_MM == type) { twip = UnitsOfMeasurement.mmToTwip(fVal); } else { log.error("No support for unit " + type); twip = 0; } this.setObject(BigInteger.valueOf(twip) ); }
} else if (CSSPrimitiveValue.CSS_IN == type) { twip = UnitsOfMeasurement.inchToTwip(fVal); } else if (CSSPrimitiveValue.CSS_PT == type) {
twip = UnitsOfMeasurement.inchToTwip(fVal); } else if (CSSPrimitiveValue.CSS_MM == type) { twip = UnitsOfMeasurement.mmToTwip(fVal);
public AbstractCellMargin(CSSValue value, String suffix) { CSSPrimitiveValue cssPrimitiveValue = (CSSPrimitiveValue)value; TblWidth tblWidth = Context.getWmlObjectFactory().createTblWidth(); short ignored = 1; float fVal = cssPrimitiveValue.getFloatValue(ignored); // unit type ignored in cssparser int twip; short type = cssPrimitiveValue.getPrimitiveType(); if (CSSPrimitiveValue.CSS_IN == type) { twip = UnitsOfMeasurement.inchToTwip(fVal); } else if (CSSPrimitiveValue.CSS_MM == type) { twip = UnitsOfMeasurement.mmToTwip(fVal); } else if (CSSPrimitiveValue.CSS_PERCENTAGE == type) { twip = twipFromPercentage(fVal); } else { log.error("No support for unit " + type); twip = 0; } init(suffix); tblWidth.setW(BigInteger.valueOf(twip)); tblWidth.setType(TblWidth.TYPE_DXA); this.setObject(tblWidth); }
twip = UnitsOfMeasurement.inchToTwip(fVal); } else if (CSSPrimitiveValue.CSS_MM == type) { twip = UnitsOfMeasurement.mmToTwip(fVal);
twip = UnitsOfMeasurement.inchToTwip(fVal); } else if (CSSPrimitiveValue.CSS_MM == type) { twip = UnitsOfMeasurement.mmToTwip(fVal);
/** * @since 3.0.0 */ public static int pxToTwip(float px) { float inch = px/DPI; return inchToTwip(inch); }
public static int mmToTwip(float mm ) { float inch = mm*0.0394f; return inchToTwip(inch); }
public SpaceBefore(CSSValue value) { debug(CSS_NAME, value); CSSPrimitiveValue cssPrimitiveValue = (CSSPrimitiveValue)value; short ignored = 1; float fVal = cssPrimitiveValue.getFloatValue(ignored); // unit type ignored in cssparser int twip; short type = cssPrimitiveValue.getPrimitiveType(); if (CSSPrimitiveValue.CSS_IN == type) { twip = UnitsOfMeasurement.inchToTwip(fVal); } else if (CSSPrimitiveValue.CSS_MM == type) { twip = UnitsOfMeasurement.mmToTwip(fVal); } else { log.error("No support for unit " + type); twip = 0; } this.setObject(BigInteger.valueOf(twip) ); }
} else if (CSSPrimitiveValue.CSS_IN == type) { twip = UnitsOfMeasurement.inchToTwip(fVal); } else if (CSSPrimitiveValue.CSS_PT == type) {
twip = UnitsOfMeasurement.inchToTwip(fVal); } else if (CSSPrimitiveValue.CSS_MM == type) { twip = UnitsOfMeasurement.mmToTwip(fVal);
public AbstractCellMargin(CSSValue value, String suffix) { CSSPrimitiveValue cssPrimitiveValue = (CSSPrimitiveValue)value; TblWidth tblWidth = Context.getWmlObjectFactory().createTblWidth(); short ignored = 1; float fVal = cssPrimitiveValue.getFloatValue(ignored); // unit type ignored in cssparser int twip; short type = cssPrimitiveValue.getPrimitiveType(); if (CSSPrimitiveValue.CSS_IN == type) { twip = UnitsOfMeasurement.inchToTwip(fVal); } else if (CSSPrimitiveValue.CSS_MM == type) { twip = UnitsOfMeasurement.mmToTwip(fVal); } else if (CSSPrimitiveValue.CSS_PERCENTAGE == type) { twip = twipFromPercentage(fVal); } else { log.error("No support for unit " + type); twip = 0; } init(suffix); tblWidth.setW(BigInteger.valueOf(twip)); tblWidth.setType(TblWidth.TYPE_DXA); this.setObject(tblWidth); }
twip = UnitsOfMeasurement.inchToTwip(fVal); } else if (CSSPrimitiveValue.CSS_MM == type) { twip = UnitsOfMeasurement.mmToTwip(fVal);
twip = UnitsOfMeasurement.inchToTwip(fVal); } else if (CSSPrimitiveValue.CSS_MM == type) { twip = UnitsOfMeasurement.mmToTwip(fVal);