/** * Get the width of the column (in Millimeter). * * @return the width of the current column (in Millimeter). */ public long getWidth() { String sWidth = maColumnElement.getProperty(OdfTableColumnProperties.ColumnWidth); if (sWidth == null) { sWidth = DEFAULT_WIDTH; } return PositiveLength.parseLong(sWidth, Unit.MILLIMETER); }
/** * Returns a PositiveLength instance representing the specified String value * * @param stringValue * a String value * @return return a PositiveLength instance representing stringValue * @throws NumberFormatException if the given argument is not a valid PostitiveLength */ public static PositiveLength valueOf(String stringValue) throws NumberFormatException { return new PositiveLength(stringValue); }
/** * Construct PositiveLength by the parsing the given string * * @param length * The String to be parsed into PositiveLength * @throws NumberFormatException if the given argument is not a valid PostitiveLength */ public PositiveLength(String length) throws NumberFormatException { super(length); if (!isValid(length)) { throw new NumberFormatException( "parameter is invalid for datatype PositiveLength"); } }
/** * Get the width of the column (in Millimeter). * * @return the width of the current column (in Millimeter). */ public double getWidth() { String sWidth = maColumnElement.getProperty(OdfTableColumnProperties.ColumnWidth); if (sWidth == null) { sWidth = DEFAULT_WIDTH; } return PositiveLength.parseDouble(sWidth, Unit.MILLIMETER) ; }
/** * Set the height/minimal height of the row (in Millimeter) according to the second parameter. * @param height * the height/minimal height that will be set to the row (in Millimeter). * @param isMinHeight * if it is true, the row can fit the height to the text, vice versa. */ public void setHeight(long height, boolean isMinHeight) { String sHeightMM = String.valueOf(height) + Unit.MILLIMETER.abbr(); String sHeightIN = PositiveLength.mapToUnit(sHeightMM, Unit.INCH); splitRepeatedRows(); maRowElement.removeAttributeNS(OdfDocumentNamespace.TABLE.getUri(), "style-name"); maRowElement.setProperty(OdfTableRowProperties.RowHeight, sHeightIN); }
/** * Get the width of the column (in Millimeter). * * @return the width of the current column (in Millimeter). */ public double getWidth() { String sWidth = maColumnElement.getProperty(OdfTableColumnProperties.ColumnWidth); if (sWidth == null) { sWidth = DEFAULT_WIDTH; } return PositiveLength.parseDouble(sWidth, Unit.MILLIMETER) ; }
/** * Set the height/minimal height of the row (in Millimeter) according to the second parameter. * @param height * the height/minimal height that will be set to the row (in Millimeter). * @param isMinHeight * if it is true, the row can fit the height to the text, vice versa. */ public void setHeight(long height, boolean isMinHeight) { String sHeightMM = String.valueOf(height) + Unit.MILLIMETER.abbr(); String sHeightIN = PositiveLength.mapToUnit(sHeightMM, Unit.INCH); splitRepeatedRows(); maRowElement.removeAttributeNS(OdfDocumentNamespace.TABLE.getUri(), "style-name"); maRowElement.setProperty(OdfTableRowProperties.RowHeight, sHeightIN); }
/** * Get the width of the column (in Millimeter). * * @return the width of the current column (in Millimeter). */ public long getWidth() { String sWidth = maColumnElement.getProperty(OdfTableColumnProperties.ColumnWidth); if (sWidth == null) { sWidth = DEFAULT_WIDTH; } return PositiveLength.parseLong(sWidth, Unit.MILLIMETER); }
/** * Get the width of the column (in Millimeter). * * @return the width of the current column (in Millimeter). */ public double getWidth() { String sWidth = maColumnElement.getProperty(OdfTableColumnProperties.ColumnWidth); if (sWidth == null) { sWidth = DEFAULT_WIDTH; } return PositiveLength.parseDouble(sWidth, Unit.MILLIMETER) ; }
/** * Set the height/minimal height of the row (in Millimeter) according to the second parameter. * @param height * the height/minimal height that will be set to the row (in Millimeter). * @param isMinHeight * if it is true, the row can fit the height to the text, vice versa. */ public void setHeight(long height, boolean isMinHeight) { String sHeightMM = String.valueOf(height) + Unit.MILLIMETER.abbr(); String sHeightIN = PositiveLength.mapToUnit(sHeightMM, Unit.INCH); splitRepeatedRows(); maRowElement.removeAttributeNS(OdfDocumentNamespace.TABLE.getUri(), "style-name"); maRowElement.setProperty(OdfTableRowProperties.RowHeight, sHeightIN); }
/** * Returns a PositiveLength instance representing the specified String value * * @param stringValue * a String value * @return return a PositiveLength instance representing stringValue * @throws NumberFormatException if the given argument is not a valid PostitiveLength */ public static PositiveLength valueOf(String stringValue) throws NumberFormatException { return new PositiveLength(stringValue); }
/** * Construct PositiveLength by the parsing the given string * * @param length * The String to be parsed into PositiveLength * @throws NumberFormatException if the given argument is not a valid PostitiveLength */ public PositiveLength(String length) throws NumberFormatException { super(length); if (!isValid(length)) { throw new NumberFormatException( "parameter is invalid for datatype PositiveLength"); } }
/** * Get the width of the column (in Millimeter). * * @return the width of the current column (in Millimeter). */ public long getWidth() { String sWidth = maColumnElement.getProperty(OdfTableColumnProperties.ColumnWidth); if (sWidth == null) { sWidth = DEFAULT_WIDTH; } return PositiveLength.parseLong(sWidth, Unit.MILLIMETER); }
/** * Return the height of the row (in Millimeter). * <p> * Return the minimal height, if the row height is not set, * * @return the height of the current row (in Millimeter). */ public double getHeight() { String sHeight = maRowElement.getProperty(OdfTableRowProperties.RowHeight); if (sHeight == null) { sHeight = maRowElement.getProperty(OdfTableRowProperties.MinRowHeight); } if (sHeight == null) { sHeight = DEFAULT_HEIGHT; } return PositiveLength.parseDouble(sHeight, Unit.MILLIMETER); }
/** * Set the width of the table (in Millimeter). * <p> * Throw an UnsupportedOperationException if the * table is part of a spreadsheet document that does not allow to change the table size, * because spreadsheet is not allow user to set the table size. * * @param width the width that need to set (in Millimeter). * <p> * An UnsupportedOperationException will be thrown if the table is in the spreadsheet document. */ public void setWidth(long width) { if (!mIsSpreadsheet) { String sWidthMM = String.valueOf(width) + Unit.MILLIMETER.abbr(); String sWidthIN = PositiveLength.mapToUnit(sWidthMM, Unit.INCH); mTableElement.setProperty(OdfTableProperties.Width, sWidthIN); //if the width is changed, we should also change the table:align properties if it is "margins" //otherwise the width seems not changed String alineStyle = mTableElement.getProperty(StyleTablePropertiesElement.Align); if (TableAlignAttribute.Value.MARGINS.toString().equals(alineStyle)) { mTableElement.setProperty(StyleTablePropertiesElement.Align, TableAlignAttribute.Value.LEFT.toString()); } } else { throw new UnsupportedOperationException(); } }
/** * Returns a PositiveLength instance representing the specified String value * * @param stringValue * a String value * @return return a PositiveLength instance representing stringValue * @throws NumberFormatException if the given argument is not a valid PostitiveLength */ public static PositiveLength valueOf(String stringValue) throws NumberFormatException { return new PositiveLength(stringValue); }
/** * Construct PositiveLength by the parsing the given string * * @param length * The String to be parsed into PositiveLength * @throws NumberFormatException if the given argument is not a valid PostitiveLength */ public PositiveLength(String length) throws NumberFormatException { super(length); if (!isValid(length)) { throw new NumberFormatException( "parameter is invalid for datatype PositiveLength"); } }
/** * Return the height of the row (in Millimeter). * <p> * Return the minimal height, if the row height is not set, * @return the height of the current row (in Millimeter). */ public long getHeight() { String sHeight = maRowElement.getProperty(OdfTableRowProperties.RowHeight); if (sHeight == null) { sHeight = maRowElement.getProperty(OdfTableRowProperties.MinRowHeight); } if (sHeight == null) { sHeight = DEFAULT_HEIGHT; } return PositiveLength.parseLong(sHeight, Unit.MILLIMETER); }
/** * Return the height of the row (in Millimeter). * <p> * Return the minimal height, if the row height is not set, * * @return the height of the current row (in Millimeter). */ public double getHeight() { String sHeight = maRowElement.getProperty(OdfTableRowProperties.RowHeight); if (sHeight == null) { sHeight = maRowElement.getProperty(OdfTableRowProperties.MinRowHeight); } if (sHeight == null) { sHeight = DEFAULT_HEIGHT; } return PositiveLength.parseDouble(sHeight, Unit.MILLIMETER); }
/** * Set the width of the table (in Millimeter). * <p> * Throw an UnsupportedOperationException if the * table is part of a spreadsheet document that does not allow to change the table size, * because spreadsheet is not allow user to set the table size. * * @param width the width that need to set (in Millimeter). * <p> * An UnsupportedOperationException will be thrown if the table is in the spreadsheet document. */ public void setWidth(long width) { if (!mIsSpreadsheet) { String sWidthMM = String.valueOf(width) + Unit.MILLIMETER.abbr(); String sWidthIN = PositiveLength.mapToUnit(sWidthMM, Unit.INCH); mTableElement.setProperty(OdfTableProperties.Width, sWidthIN); //if the width is changed, we should also change the table:align properties if it is "margins" //otherwise the width seems not changed String alineStyle = mTableElement.getProperty(StyleTablePropertiesElement.Align); if (TableAlignAttribute.Value.MARGINS.toString().equals(alineStyle)) { mTableElement.setProperty(StyleTablePropertiesElement.Align, TableAlignAttribute.Value.LEFT.toString()); } } else { throw new UnsupportedOperationException(); } }