/** * 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); }
/** * 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); }
/** * 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); }
/** * 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(); } }
/** * 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(); } }
/** * 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(); } }
/** * Set the width of the column (in Millimeter). * @param width * the width that will be set to the column (in Millimeter). */ public void setWidth(long width) { String sWidthMM = String.valueOf(width) + Unit.MILLIMETER.abbr(); String sWidthIN = PositiveLength.mapToUnit(sWidthMM, Unit.INCH); splitRepeatedColumns(); maColumnElement.setProperty(OdfTableColumnProperties.ColumnWidth, sWidthIN); //check if need set relative width int index = getColumnIndex(); if (index >= 1) { index = index - 1; } else { index = index + 1; } OdfTableColumn column = null; if (index < getTable().getColumnCount()) { column = getTable().getColumnByIndex(index); } if (column != null) { long prevColumnRelWidth = column.getRelativeWidth(); if (prevColumnRelWidth != 0) { long prevColumnWidth = column.getWidth(); setRelativeWidth(prevColumnRelWidth / prevColumnWidth * width); } } }
/** * Set the width of the column (in Millimeter). * @param width * the width that will be set to the column (in Millimeter). */ public void setWidth(long width) { String sWidthMM = String.valueOf(width) + Unit.MILLIMETER.abbr(); String sWidthIN = PositiveLength.mapToUnit(sWidthMM, Unit.INCH); splitRepeatedColumns(); maColumnElement.setProperty(OdfTableColumnProperties.ColumnWidth, sWidthIN); //check if need set relative width int index = getColumnIndex(); if (index >= 1) { index = index - 1; } else { index = index + 1; } OdfTableColumn column = null; if (index < getTable().getColumnCount()) { column = getTable().getColumnByIndex(index); } if (column != null) { long prevColumnRelWidth = column.getRelativeWidth(); if (prevColumnRelWidth != 0) { long prevColumnWidth = column.getWidth(); setRelativeWidth(prevColumnRelWidth / prevColumnWidth * width); } } }
/** * Set the width of the column (in Millimeter). * @param width * the width that will be set to the column (in Millimeter). */ public void setWidth(long width) { String sWidthMM = String.valueOf(width) + Unit.MILLIMETER.abbr(); String sWidthIN = PositiveLength.mapToUnit(sWidthMM, Unit.INCH); splitRepeatedColumns(); maColumnElement.setProperty(OdfTableColumnProperties.ColumnWidth, sWidthIN); //check if need set relative width int index = getColumnIndex(); if (index >= 1) { index = index - 1; } else { index = index + 1; } OdfTableColumn column = null; if (index < getTable().getColumnCount()) { column = getTable().getColumnByIndex(index); } if (column != null) { long prevColumnRelWidth = column.getRelativeWidth(); if (prevColumnRelWidth != 0) { long prevColumnWidth = column.getWidth(); setRelativeWidth(prevColumnRelWidth / prevColumnWidth * width); } } }