[]
IRange. Actions such as changing the conditional formatting or table style of a range can cause what is displayed in the current user interface to be inconsistent with the values in the corresponding properties of the IRange object. Use the properties of this interface to return the values as they are displayed in the current user interface.
IRange range = worksheet.getRange("A1");
range.setValue(1234.56);
range.setNumberFormat("$#,##0.00");
range.getBorders().get(BordersIndex.EdgeBottom).setLineStyle(BorderLineStyle.Thin);
IFormatCondition condition = (IFormatCondition) range.getFormatConditions().add(
FormatConditionType.CellValue, FormatConditionOperator.Greater, "1000", null);
condition.setNumberFormat("0.00%");
condition.getBorders().get(BordersIndex.EdgeBottom).setLineStyle(BorderLineStyle.Thick);
IDisplayFormat displayFormat = range.getDisplayFormat();
String numberFormat = displayFormat.getNumberFormat();
IBorders borders = displayFormat.getBorders();
booleanIRange when the text alignment in a cell is set to equal distribution, either horizontally or vertically, as it is displayed in the current user interface.IRange object as it is displayed in the current user interface.getFont()IRange as it is displayed in the current user interface.booleanIRange object is hidden when the worksheet is protected as it is displayed in the current user interface.IRange object as it is displayed in the current user interface.intIRange object as it is displayed in the current user interface.IRange object as it is displayed in the current user interface.booleanIRange is locked as it is displayed in the current user interface.booleanIRange object contains merged cells as it is displayed in the current user interface.IRange object as it is displayed in the current user interface.intIRange object as it is displayed in the current user interface.IRange object as it is displayed in the current user interface.booleanIRange object as it is displayed in the current user interface.getStyle()IStyle object associated with the range.IRange object as it is displayed in the current user interface.booleanIRange object as it is displayed in the current user interface.IRange when the text alignment in a cell is set to equal distribution, either horizontally or vertically, as it is displayed in the current user interface. This property reflects the displayed format of the associated range, which can differ from the underlying range settings.
IRange range = worksheet.getRange("A1");
range.setValue("Test");
range.setHorizontalAlignment(HorizontalAlignment.Distributed);
range.setAddIndent(true);
boolean addIndent = range.getDisplayFormat().getAddIndent();
true if text is automatically indented when the text alignment in the cell is set, either horizontally or vertically, to equal distribution; otherwise, false.IRange object as it is displayed in the current user interface.The returned IBorders reflects the displayed border settings of the associated range. These displayed settings can differ from the corresponding border properties of the range itself when the current appearance is affected by features such as conditional formatting or table styles. Use IRange.getDisplayFormat() to read the border settings as they appear in the user interface.
IRange cell = worksheet.getRange("A1");
cell.setValue(1234.56);
cell.getBorders().get(BordersIndex.EdgeBottom).setLineStyle(BorderLineStyle.Thin);
IFormatCondition condition = (IFormatCondition) cell.getFormatConditions().add(
FormatConditionType.CellValue, FormatConditionOperator.Greater, "1000", null);
condition.getBorders().get(BordersIndex.EdgeBottom).setLineStyle(BorderLineStyle.Thick);
IBorders borders = cell.getDisplayFormat().getBorders();
IBorder bottomBorder = borders.get(BordersIndex.EdgeBottom);
IBorders object that represents the displayed borders of the associated range.IRange as it is displayed in the current user interface. The returned IFont reflects the displayed font of the associated IRange. This displayed font can differ from the underlying font settings of the range when the current appearance is affected by features such as conditional formatting, table styles, or number formats.
IRange range = worksheet.getRange("A1");
range.setValue(1234.56);
range.getFont().setColor(Color.GetBlack());
IFormatCondition condition = (IFormatCondition) range.getFormatConditions().add(
FormatConditionType.CellValue, FormatConditionOperator.Greater, "1000", null);
condition.getFont().setColor(Color.GetBlue());
IFont font = range.getDisplayFormat().getFont();
Color color = font.getColor();
IFont object that represents the displayed font of the associated range.IRange object is hidden when the worksheet is protected as it is displayed in the current user interface. This property returns the displayed protection setting for the associated range. Use IRange.setFormulaHidden(boolean) to hide formulas when the worksheet is protected.
IRange range = worksheet.getRange("A1");
range.setFormula("=SUM(B1:B2)");
range.setFormulaHidden(true);
boolean formulaHidden = range.getDisplayFormat().getFormulaHidden();
true if the formula is hidden when the worksheet is protected and displayed in the current user interface; otherwise, false.IRange object as it is displayed in the current user interface.Use this method to retrieve the effective horizontal alignment shown in the user interface, which can differ from the corresponding IRange property when conditional formatting or table styles are applied.
IRange range = worksheet.getRange("A1");
range.setValue("Test");
range.setHorizontalAlignment(HorizontalAlignment.Center);
HorizontalAlignment alignment = range.getDisplayFormat().getHorizontalAlignment();
HorizontalAlignment value that indicates the horizontal alignment of the associated IRange object as displayed in the current user interface.IRange object as it is displayed in the current user interface. Use this method to retrieve the effective indent level shown for the range, which can differ from the range's own formatting properties when display-affecting features such as conditional formatting are applied.
IRange range = worksheet.getRange("A1");
range.setValue("Test");
range.setIndentLevel(2);
int indentLevel = range.getDisplayFormat().getIndentLevel();
IRange object as displayed in the current user interface.IRange object as it is displayed in the current user interface.The returned IInterior reflects the displayed fill settings of the associated IRange. These displayed settings can differ from the corresponding interior properties of the range itself when the current appearance is affected by features such as conditional formatting or table styles. Use IRange.getDisplayFormat() to read the interior settings as they appear in the user interface.
IRange range = worksheet.getRange("A1");
range.setValue(1234.56);
range.getInterior().setColor(Color.GetYellow());
IFormatCondition condition = (IFormatCondition) range.getFormatConditions().add(
FormatConditionType.CellValue, FormatConditionOperator.Greater, "1000", null);
condition.getInterior().setColor(Color.GetBlue());
IInterior interior = range.getDisplayFormat().getInterior();
Color color = interior.getColor();
IInterior object that represents the displayed interior of the associated range.IRange is locked as it is displayed in the current user interface. This property returns the displayed protection setting for the associated range.
IRange range = worksheet.getRange("A1");
range.setValue("Test");
range.setLocked(true);
boolean locked = range.getDisplayFormat().getLocked();
true if the associated range is locked as displayed in the current user interface; otherwise, false.IRange object contains merged cells as it is displayed in the current user interface.
IRange range = worksheet.getRange("A1:B1");
range.setValue("Test");
range.merge();
boolean mergeCells = range.getDisplayFormat().getMergeCells();
true if the associated IRange object contains merged cells; otherwise, false.IRange object as it is displayed in the current user interface. Use this method to retrieve the effective number format currently shown for the range. This displayed format can differ from the range's own format settings when display-affecting features such as conditional formatting or table styles are applied.
IRange range = worksheet.getRange("A1");
range.setNumberFormat("$#,##0.00");
range.setValue(1234.5);
String numberFormat = range.getDisplayFormat().getNumberFormat();
IRange object as displayed in the current user interface.IRange object as it is displayed in the current user interface.The returned value represents the displayed text rotation in degrees. It follows the same orientation values as IRange.getOrientation(), such as values from -90 to 90, or 255 for vertical text.
IRange range = worksheet.getRange("A1");
range.setValue("Test");
range.setOrientation(45);
int orientation = range.getDisplayFormat().getOrientation();
IRange object as displayed in the current user interface.IRange object as it is displayed in the current user interface. This value reflects the displayed format of the range and can differ from the corresponding IRange property when the displayed result is affected by formatting such as conditional formatting or table styles.
IRange range = worksheet.getRange("A1");
range.setValue("Test");
range.setReadingOrder(ReadingOrder.RightToLeft);
ReadingOrder readingOrder = range.getDisplayFormat().getReadingOrder();
ReadingOrder of the associated IRange object.IRange object as it is displayed in the current user interface. This property reflects the displayed format of the associated range, which can differ from the underlying range settings.
IRange range = worksheet.getRange("A1");
range.setValue("Long text");
range.setShrinkToFit(true);
boolean shrinkToFit = range.getDisplayFormat().getShrinkToFit();
true if the application automatically shrinks text to fit in the available column width of the associated range as displayed in the current user interface; otherwise, false.IStyle object associated with the range.The returned style is the range's underlying style object. Display-only changes introduced by conditional formatting or table styles are not merged into this style object. To read values as they are currently displayed in the user interface, use other IDisplayFormat members such as getNumberFormat(), getFont(), or getBorders().
IStyle currencyStyle = workbook.getStyles().add("CurrencyStyle");
currencyStyle.setNumberFormat("$#,##0.00");
IRange range = worksheet.getRange("A1");
range.setValue(1234.56);
range.setStyle(currencyStyle);
IFormatCondition condition = (IFormatCondition) range.getFormatConditions().add(
FormatConditionType.CellValue, FormatConditionOperator.Greater, "1000", null);
condition.setNumberFormat("0.00%");
IStyle style = range.getDisplayFormat().getStyle();
String baseNumberFormat = style.getNumberFormat();
String displayedNumberFormat = range.getDisplayFormat().getNumberFormat();
IStyle object associated with the range.IRange object as it is displayed in the current user interface.Use this property to retrieve the effective vertical alignment shown for the range, which can differ from the corresponding range property when display settings are affected by features such as conditional formatting or table styles.
IRange range = worksheet.getRange("A1");
range.setValue("Test");
range.setVerticalAlignment(VerticalAlignment.Center);
VerticalAlignment alignment = range.getDisplayFormat().getVerticalAlignment();
IRange object as it is displayed in the current user interface.This property reflects the displayed format of the associated range, which can differ from the underlying IRange settings.
IRange range = worksheet.getRange("A1");
range.setValue("Test");
range.setWrapText(true);
boolean wrapText = range.getDisplayFormat().getWrapText();
true if the application wraps the text of the associated range as displayed in the current user interface; otherwise, false.