[]
        
(Showing Draft Content)

IRange

Interface IRange


public interface IRange
Represents cells, rows, columns, or cell ranges in a worksheet.

 IRange range = worksheet.getRange("A1:B2");
 range.setValue(new Object[][] {{"Name", "Score"}, {"Alice", 95}});
 range.getInterior().setColor(Color.GetLightYellow());
 Object value = worksheet.getRange("B2").getValue();
 
  • Method Details

    • getRows

      IRange getRows()
      Returns the IRange object that represents the rows in the specified range.
      
       IRange range = worksheet.getRange("B2:C3");
       IRange rows = range.getRows();
       int rowCount = rows.getCount();
       
      Returns:
      The IRange object that represents the rows in the specified range.
    • getColumns

      IRange getColumns()
      Returns the IRange object that represents the columns in the specified range.
      
       IRange range = worksheet.getRange("B2:C3");
       IRange columns = range.getColumns();
       int columnCount = columns.getCount();
       
      Returns:
      The IRange object that represents the columns in the specified range.
    • getCells

      IRange getCells()
      Returns the IRange object that represents the cells in the specified range.
      
       IRange range = worksheet.getRange("B2:C3");
       IRange cells = range.getCells();
       int cellCount = cells.getCount();
       
      Returns:
      The IRange object that represents the cells in the specified range.
    • getRow

      int getRow()
      Returns the zero based row number of the first row.
      
       IRange range = worksheet.getRange("B2:C3");
       int row = range.getRow();
       
      Returns:
      The zero based row number of the first row.
    • getLastRow

      int getLastRow()
      Returns the zero based row number of the last row of the first range.
      
       IRange range = worksheet.getRange("B2:C3");
       int lastRow = range.getLastRow();
       
      Returns:
      The zero based row number of the last row of the first range.
    • getRowCount

      int getRowCount()
      Returns the row count of the first range.
      
       IRange range = worksheet.getRange("B2:C3");
       int rowCount = range.getRowCount();
       
      Returns:
      The row count of the first range.
    • getColumn

      int getColumn()
      Returns the zero based column number of the first column of this IRange.
      
       IRange range = worksheet.getRange("B2:C3");
       int column = range.getColumn();
       
      Returns:
      The zero based column number of the first column of this IRange.
    • getLastColumn

      int getLastColumn()
      Returns the zero based column number of the last column of the first range.
      
       IRange range = worksheet.getRange("B2:C3");
       int lastColumn = range.getLastColumn();
       
      Returns:
      The zero based column number of the last column of the first range.
    • getColumnCount

      int getColumnCount()
      Returns the column count of the first range.
      
       IRange range = worksheet.getRange("B2:C3");
       int columnCount = range.getColumnCount();
       
      Returns:
      The column count of the first range.
    • getCount

      int getCount()
      Returns the number of objects in the collection.
      
       IRange range = worksheet.getRange("B2:C3");
       int count = range.getCount();
       
      Returns:
      The number of objects in the collection.
    • getFont

      IFont getFont()
      Returns an instance of IFont which may be used to get and set font properties of the cells represented by this IRange.
      
       IRange range = worksheet.getRange("A1");
       IFont font = range.getFont();
       font.setBold(true);
       boolean bold = range.getFont().getBold();
       
      Returns:
      An IFont instance used to get and set font properties of the cells represented by this IRange; see IFont and IRange.
    • getBorders

      IBorders getBorders()
      Returns an instance of IBorders which represents the cell borders of the cell or range represented by this IRange.
      
       IRange range = worksheet.getRange("A1");
       IBorder border = range.getBorders().get(BordersIndex.EdgeBottom);
       border.setLineStyle(BorderLineStyle.Thin);
       BorderLineStyle style = border.getLineStyle();
       
      Returns:
      An IBorders instance that represents the cell borders of the cell or range represented by this IRange; see IBorders and IRange.
    • getInterior

      IInterior getInterior()
      Returns the IInterior which represents the interior (background)color and pattern of the specified cell(s).
      
       IRange range = worksheet.getRange("A1");
       IInterior interior = range.getInterior();
       interior.setColor(Color.GetLightYellow());
       Color color = range.getInterior().getColor();
       
      Returns:
      The IInterior object that represents the interior (background) color and pattern of the specified cell(s).
    • getNumberFormat

      String getNumberFormat()
      Gets the number format of the cells in the range.
      
       IRange range = worksheet.getRange("A1");
       range.setNumberFormat("$#,##0.00");
       String numberFormat = range.getNumberFormat();
       
      Returns:
      The number format of the cells in the range.
    • setNumberFormat

      void setNumberFormat(String value)
      Sets the number format of the cells in the range.
      
       IRange range = worksheet.getRange("A1");
       range.setValue(1234.5);
       range.setNumberFormat("$#,##0.00");
       String text = range.getText();
       
      Parameters:
      value - The number format of the cells in the range.
    • getAddIndent

      boolean getAddIndent()
      Gets the property which controls indentation of text when horizontal or vertical alignment is set to distributed.
      
       IRange range = worksheet.getRange("A1");
       range.setHorizontalAlignment(HorizontalAlignment.Distributed);
       range.setAddIndent(true);
       boolean addIndent = range.getAddIndent();
       
      Returns:
      true if add indent is enabled; otherwise, false.
    • setAddIndent

      void setAddIndent(boolean value)
      Sets the property which controls indentation of text when horizontal or vertical alignment is set to distributed.
      
       IRange range = worksheet.getRange("A1");
       range.setHorizontalAlignment(HorizontalAlignment.Distributed);
       range.setAddIndent(true);
       boolean addIndent = range.getAddIndent();
       
      Parameters:
      value - The property value that controls indentation of text when horizontal or vertical alignment is set to distributed.
    • getIndentLevel

      int getIndentLevel()
      Gets the indent level of the specified cell(s).
      
       IRange range = worksheet.getRange("A1");
       range.setIndentLevel(2);
       int indentLevel = range.getIndentLevel();
       
      Returns:
      The indent level of the specified cell(s).
    • setIndentLevel

      void setIndentLevel(int value)
      Sets the indent level of the specified cell(s).
      
       IRange range = worksheet.getRange("A1");
       range.setValue("Indented");
       range.setIndentLevel(2);
       int indentLevel = range.getIndentLevel();
       
      Parameters:
      value - The indent level of the specified cell(s).
    • getHidden

      boolean getHidden()
      Gets the property which specifies whether rows or columns should be hidden.
      
       IRange row = worksheet.getRange("2:2");
       row.setHidden(true);
       boolean hidden = row.getHidden();
       
      Returns:
      true if hidden is enabled; otherwise, false.
    • setHidden

      void setHidden(boolean value)
      Sets the property which specifies whether rows or columns should be hidden.
      
       IRange row = worksheet.getRange("2:2");
       row.setHidden(true);
       boolean hidden = row.getHidden();
       
      Parameters:
      value - Whether rows or columns should be hidden.
    • getLocked

      boolean getLocked()
      Gets the property which specifies whether cells should be locked.
      
       IRange range = worksheet.getRange("A1");
       range.setLocked(false);
       worksheet.protect();
       boolean locked = range.getLocked();
       
      Returns:
      true if locked is enabled; otherwise, false.
    • setLocked

      void setLocked(boolean value)
      Sets the property which specifies whether cells should be locked.
      
       IRange range = worksheet.getRange("A1");
       range.setLocked(false);
       worksheet.protect();
       boolean locked = range.getLocked();
       
      Parameters:
      value - Whether cells should be locked.
    • getOrientation

      int getOrientation()
      Gets the text orientation of a cell or range, which may be from -90 to 90 degrees, or 255(vertical text).
      
       IRange range = worksheet.getRange("A1");
       range.setValue("Rotated");
       range.setOrientation(45);
       int orientation = range.getOrientation();
       
      Returns:
      The text orientation of a cell or range, which may be from -90 to 90 degrees, or 255(vertical text).
    • setOrientation

      void setOrientation(int value)
      Sets the text orientation of a cell or range, which may be from -90 to 90 degrees, or 255(vertical text).
      
       IRange range = worksheet.getRange("A1");
       range.setValue("Rotated");
       range.setOrientation(45);
       int orientation = range.getOrientation();
       
      Parameters:
      value - The text orientation of a cell or range, which may be from -90 to 90 degrees, or 255(vertical text).
    • getShrinkToFit

      boolean getShrinkToFit()
      Gets the property which specifies whether cells will be drawn in a smaller font if needed to display the contents of the cell.
      
       IRange range = worksheet.getRange("A1");
       range.setValue("Long text");
       range.setShrinkToFit(true);
       boolean shrinkToFit = range.getShrinkToFit();
       
      Returns:
      true if shrink to fit is enabled; otherwise, false.
    • setShrinkToFit

      void setShrinkToFit(boolean value)
      Sets the property which specifies whether cells will be drawn in a smaller font if needed to display the contents of the cell.
      
       IRange range = worksheet.getRange("A1");
       range.setValue("Long text");
       range.setShrinkToFit(true);
       boolean shrinkToFit = range.getShrinkToFit();
       
      Parameters:
      value - Whether cells will be drawn in a smaller font if needed to display the contents of the cell.
    • getWrapText

      boolean getWrapText()
      Get the flag which indicates whether word wrap is enabled in a cell.
      
       IRange range = worksheet.getRange("A1");
       range.setValue("Line 1\nLine 2");
       range.setWrapText(true);
       boolean wrapText = range.getWrapText();
       
      Returns:
      true if wrap text is enabled; otherwise, false.
    • setWrapText

      void setWrapText(boolean value)
      Sets the flag which indicates whether word wrap is enabled in a cell.
      
       IRange range = worksheet.getRange("A1");
       range.setValue("Line 1\nLine 2");
       range.setWrapText(true);
       boolean wrapText = range.getWrapText();
       
      Parameters:
      value - Whether word wrap is enabled in a cell.
    • getHorizontalAlignment

      HorizontalAlignment getHorizontalAlignment()
      Gets the HorizontalAlignment of a cell or range.
      
       IRange range = worksheet.getRange("A1:C1");
       range.setValue("Quarterly Report");
       range.setHorizontalAlignment(HorizontalAlignment.Center);
       HorizontalAlignment alignment = range.getHorizontalAlignment();
       
      Returns:
      The HorizontalAlignment of a cell or range.
    • setHorizontalAlignment

      void setHorizontalAlignment(HorizontalAlignment value)
      Sets the HorizontalAlignment of a cell or range.
      
       IRange range = worksheet.getRange("A1:C1");
       range.setValue("Quarterly Report");
       range.setHorizontalAlignment(HorizontalAlignment.Center);
       HorizontalAlignment alignment = range.getHorizontalAlignment();
       
      Parameters:
      value - The HorizontalAlignment of a cell or range.
    • getVerticalAlignment

      VerticalAlignment getVerticalAlignment()
      Gets the VerticalAlignment of a cell or range.
      
       IRange range = worksheet.getRange("A1");
       range.setVerticalAlignment(VerticalAlignment.Center);
       VerticalAlignment alignment = range.getVerticalAlignment();
       
      Returns:
      The VerticalAlignment of a cell or range.
    • setVerticalAlignment

      void setVerticalAlignment(VerticalAlignment value)
      Sets the VerticalAlignment of a cell or range.
      
       IRange range = worksheet.getRange("A1");
       range.setValue("Centered");
       range.setVerticalAlignment(VerticalAlignment.Center);
       VerticalAlignment alignment = range.getVerticalAlignment();
       
      Parameters:
      value - The VerticalAlignment of a cell or range.
    • getDisplayFormat

      IDisplayFormat getDisplayFormat()
      Gets a DisplayFormat object that represents the display settings for the specified range.
      
       IRange range = worksheet.getRange("A1");
       range.getInterior().setColor(Color.GetLightYellow());
       IDisplayFormat displayFormat = range.getDisplayFormat();
       Color color = displayFormat.getInterior().getColor();
       
      Returns:
      A DisplayFormat object that represents the display settings for the specified range.
    • getFormulaHidden

      boolean getFormulaHidden()
      Gets or sets whether the formula will be hidden when the worksheet is protected.
      
       IRange range = worksheet.getRange("A1");
       range.setFormula("=1+1");
       range.setFormulaHidden(true);
       boolean formulaHidden = range.getFormulaHidden();
       
      Returns:
      true if formula hidden is enabled; otherwise, false.
    • setFormulaHidden

      void setFormulaHidden(boolean value)
      Sets whether the formula will be hidden when the worksheet is protected.
      
       IRange range = worksheet.getRange("A1");
       range.setFormula("=1+1");
       range.setFormulaHidden(true);
       boolean formulaHidden = range.getFormulaHidden();
       
      Parameters:
      value - Whether the formula will be hidden when the worksheet is protected.
    • getReadingOrder

      ReadingOrder getReadingOrder()
      Gets or Sets the reading order for the specified object.
      
       IRange range = worksheet.getRange("A1");
       range.setReadingOrder(ReadingOrder.RightToLeft);
       ReadingOrder readingOrder = range.getReadingOrder();
       
      Returns:
      or Sets the reading order for the specified object.
    • setReadingOrder

      void setReadingOrder(ReadingOrder value)
      Sets the reading order for the specified object.
      
       IRange range = worksheet.getRange("A1");
       range.setValue("שלום");
       range.setReadingOrder(ReadingOrder.RightToLeft);
       ReadingOrder readingOrder = range.getReadingOrder();
       
      Parameters:
      value - The reading order for the specified object.
    • getStyle

      IStyle getStyle()
      Gets the named style IStyle associated with the cells represented by this IRange.
      
       IStyle style = workbook.getStyles().add("InputStyle");
       style.getFont().setBold(true);
       IRange range = worksheet.getRange("A1");
       range.setStyle(style);
       IStyle appliedStyle = range.getStyle();
       
      Returns:
      The named style associated with the cells represented by this IRange.
    • setStyle

      void setStyle(IStyle value)
      Sets the named style IStyle associated with the cells represented by this IRange.
      
       IStyle style = workbook.getStyles().add("InputStyle");
       style.getFont().setBold(true);
       IRange range = worksheet.getRange("A1");
       range.setStyle(style);
       IStyle appliedStyle = range.getStyle();
       
      Parameters:
      value - The named style IStyle associated with the cells represented by this IRange.
    • getValidation

      IValidation getValidation()
      Returns an instance of IValidation which may be used to get and set validation properties of the cells represented by this IRange.
      
       IRange range = worksheet.getRange("A1");
       IValidation validation = range.getValidation();
       validation.add(ValidationType.Whole, ValidationAlertStyle.Stop, ValidationOperator.Between, 1, 10);
       boolean hasValidation = range.getHasValidation();
       
      Returns:
      An IValidation instance used to get and set validation properties of the cells represented by this IRange; see IValidation and IRange.
    • getHyperlinks

      IHyperlinks getHyperlinks()
      Returns an instance of IHyperlinks which may be used to get and set HyperLinks properties.
      
       IRange range = worksheet.getRange("A1");
       IHyperlinks hyperlinks = range.getHyperlinks();
       hyperlinks.add(range, "https://www.example.com");
       int hyperlinkCount = hyperlinks.getCount();
       
      Returns:
      An instance of IHyperlinks which may be used to get and set HyperLinks properties.
    • getComment

      IComment getComment()
      Returns an instance of IComment which may be used to get and set Comment properties of the cells.
      
       IRange range = worksheet.getRange("A1");
       range.addComment("Review this value.");
       IComment comment = range.getComment();
       String text = comment.getText();
       
      Returns:
      An IComment instance used to get and set comment properties of the cells; see IComment.
    • getSparklineGroups

      ISparklineGroups getSparklineGroups()
      Returns the sparkline groups for the cells.
      
       worksheet.getRange("A1:A3").setValue(new Object[][] {{1}, {2}, {3}});
       IRange location = worksheet.getRange("B1:B3");
       ISparklineGroups sparklineGroups = location.getSparklineGroups();
       sparklineGroups.add(SparkType.Line, "A1:A3");
       int groupCount = sparklineGroups.getCount();
       
      Returns:
      The ISparklineGroups collection for the cells; see ISparklineGroups.
    • getWorksheet

      IWorksheet getWorksheet()
      Returns the parent IWorksheet of this range.
      
       IRange range = worksheet.getRange("A1");
       IWorksheet parentWorksheet = range.getWorksheet();
       String sheetName = parentWorksheet.getName();
       
      Returns:
      The parent of this range.
    • getEntireRow

      IRange getEntireRow()
      Returns a new instance of IRange which represents the same range of cells, but expanded to include all columns.
      
       IRange range = worksheet.getRange("B2:C3");
       IRange entireRow = range.getEntireRow();
       int columnCount = entireRow.getColumnCount();
       
      Returns:
      A new IRange instance that represents the same cells expanded to include all columns; see IRange.
    • getEntireColumn

      IRange getEntireColumn()
      Returns a new instance of IRange which represents the same range of cells, but expanded to include all rows.
      
       IRange range = worksheet.getRange("B2:C3");
       IRange entireColumn = range.getEntireColumn();
       int rowCount = entireColumn.getRowCount();
       
      Returns:
      A new IRange instance that represents the same cells expanded to include all rows; see IRange.
    • getEntireMergeArea

      IRange getEntireMergeArea()
      Returns an IRange representing the area of the current range which is iteratively grown as needed until it includes no partial merged cells.
      
       worksheet.getRange("A1:B2").merge();
       IRange mergeArea = worksheet.getRange("A1").getEntireMergeArea();
       int rowCount = mergeArea.getRowCount();
       
      Returns:
      An IRange instance representing the area grown as needed until it includes no partial merged cells; see IRange.
    • getMergeArea

      IRange getMergeArea()
      Returns an IRange representing the merged range containing the specified cell. If the specified cell isn't in a merged range, this property returns the specified cell.
      
       worksheet.getRange("A1:B2").merge();
       IRange mergeArea = worksheet.getRange("A1").getMergeArea();
       String address = mergeArea.getAddress();
       
      Returns:
      An IRange representing the merged range containing the specified cell.
    • getFormula

      String getFormula()
      Gets the formula of the cells represented by this range in A1-style notation.
      
       worksheet.getRange("A1").setValue(10);
       worksheet.getRange("A2").setValue(5);
       IRange range = worksheet.getRange("B1");
       range.setFormula("=A1+A2");
       String formula = range.getFormula();
       
      Returns:
      The formula of the cells represented by this range in A1-style notation.
    • setFormula

      void setFormula(String value)
      Sets the formula of the cells represented by this range in A1-style notation.
      
       worksheet.getRange("A1").setValue(10);
       worksheet.getRange("A2").setValue(5);
       IRange range = worksheet.getRange("B1");
       range.setFormula("=A1+A2");
       workbook.calculate();
       Object value = range.getValue();
       
      Parameters:
      value - The formula of the cells represented by this range in A1-style notation.
    • getFormulaLocal

      String getFormulaLocal()
      Gets the localized formula of the cells represented by this range in A1-style notation.
      
       worksheet.getRange("A1").setValue(10);
       worksheet.getRange("A2").setValue(5);
       IRange range = worksheet.getRange("B1");
       range.setFormulaLocal("=A1+A2");
       String formula = range.getFormulaLocal();
       
      Returns:
      The localized formula of the cells represented by this range in A1-style notation.
    • setFormulaLocal

      void setFormulaLocal(String value)
      Sets the localized formula of the cells represented by this range in A1-style notation.
      
       worksheet.getRange("A1").setValue(10);
       worksheet.getRange("A2").setValue(5);
       IRange range = worksheet.getRange("B1");
       range.setFormulaLocal("=A1+A2");
       workbook.calculate();
       Object value = range.getValue();
       
      Parameters:
      value - The localized formula of the cells represented by this range in A1-style notation.
    • getFormulaR1C1

      String getFormulaR1C1()
      Gets the formula of the cells represented by this range in R1C1-style notation.
      
       worksheet.getRange("A1").setValue(10);
       worksheet.getRange("A2").setValue(5);
       IRange range = worksheet.getRange("B1");
       range.setFormulaR1C1("=RC[-1]+R[1]C[-1]");
       String formula = range.getFormulaR1C1();
       
      Returns:
      The formula of the cells represented by this range in R1C1-style notation.
    • setFormulaR1C1

      void setFormulaR1C1(String value)
      Sets the formula of the cells represented by this range in R1C1-style notation.
      
       worksheet.getRange("A1").setValue(10);
       worksheet.getRange("A2").setValue(5);
       IRange range = worksheet.getRange("B1");
       range.setFormulaR1C1("=RC[-1]+R[1]C[-1]");
       workbook.calculate();
       Object value = range.getValue();
       
      Parameters:
      value - The formula of the cells represented by this range in R1C1-style notation.
    • getFormulaR1C1Local

      String getFormulaR1C1Local()
      Gets the localized formula of the cells represented by this range in R1C1-style notation.
      
       worksheet.getRange("A1").setValue(10);
       worksheet.getRange("A2").setValue(5);
       IRange range = worksheet.getRange("B1");
       range.setFormulaR1C1Local("=RC[-1]+R[1]C[-1]");
       String formula = range.getFormulaR1C1Local();
       
      Returns:
      The localized formula of the cells represented by this range in R1C1-style notation.
    • setFormulaR1C1Local

      void setFormulaR1C1Local(String value)
      Sets the localized formula of the cells represented by this range in R1C1-style notation.
      
       worksheet.getRange("A1").setValue(10);
       worksheet.getRange("A2").setValue(5);
       IRange range = worksheet.getRange("B1");
       range.setFormulaR1C1Local("=RC[-1]+R[1]C[-1]");
       workbook.calculate();
       Object value = range.getValue();
       
      Parameters:
      value - The localized formula of the cells represented by this range in R1C1-style notation.
    • getFormula2

      String getFormula2()
      Gets the formula of the cells represented by this range in A1-style array notation.
      
       IRange range = worksheet.getRange("A1:A3");
       range.setFormula2("=SEQUENCE(3)");
       String formula = range.getFormula2();
       
      Returns:
      The formula of the cells represented by this range in A1-style array notation.
    • setFormula2

      void setFormula2(String value)
      Sets the formula of the cells represented by this range in A1-style array notation.
      
       IRange range = worksheet.getRange("A1:A3");
       range.setFormula2("=SEQUENCE(3)");
       workbook.calculate();
       Object value = worksheet.getRange("A1").getValue();
       
      Parameters:
      value - The formula of the cells represented by this range in A1-style array notation.
    • getFormula2Local

      String getFormula2Local()
      Gets the localized formula of the cells represented by this range in A1-style array notation.
      
       IRange range = worksheet.getRange("A1:A3");
       range.setFormula2Local("=SEQUENCE(3)");
       String formula = range.getFormula2Local();
       
      Returns:
      The localized formula of the cells represented by this range in A1-style array notation.
    • setFormula2Local

      void setFormula2Local(String value)
      Sets the localized formula of the cells represented by this range in A1-style array notation.
      
       IRange range = worksheet.getRange("A1:A3");
       range.setFormula2Local("=SEQUENCE(3)");
       workbook.calculate();
       Object value = worksheet.getRange("A1").getValue();
       
      Parameters:
      value - The localized formula of the cells represented by this range in A1-style array notation.
    • getFormula2R1C1

      String getFormula2R1C1()
      Gets the formula of the cells represented by this range in R1C1-style array notation.
      
       IRange range = worksheet.getRange("A1:A3");
       range.setFormula2R1C1("=SEQUENCE(3)");
       String formula = range.getFormula2R1C1();
       
      Returns:
      The formula of the cells represented by this range in R1C1-style array notation.
    • setFormula2R1C1

      void setFormula2R1C1(String value)
      Sets the formula of the cells represented by this range in R1C1-style array notation.
      
       IRange range = worksheet.getRange("A1:A3");
       range.setFormula2R1C1("=SEQUENCE(3)");
       workbook.calculate();
       Object value = worksheet.getRange("A1").getValue();
       
      Parameters:
      value - The formula of the cells represented by this range in R1C1-style array notation.
    • getFormula2R1C1Local

      String getFormula2R1C1Local()
      Gets the localized formula of the cells represented by this range in R1C1-style array notation.
      
       IRange range = worksheet.getRange("A1:A3");
       range.setFormula2R1C1Local("=SEQUENCE(3)");
       String formula = range.getFormula2R1C1Local();
       
      Returns:
      The localized formula of the cells represented by this range in R1C1-style array notation.
    • setFormula2R1C1Local

      void setFormula2R1C1Local(String value)
      Sets the localized formula of the cells represented by this range in R1C1-style array notation.
      
       IRange range = worksheet.getRange("A1:A3");
       range.setFormula2R1C1Local("=SEQUENCE(3)");
       workbook.calculate();
       Object value = worksheet.getRange("A1").getValue();
       
      Parameters:
      value - The localized formula of the cells represented by this range in R1C1-style array notation.
    • getFormulaArray

      String getFormulaArray()
      Gets the array formula of a range.
      
       IRange range = worksheet.getRange("A1:A3");
       range.setFormulaArray("=ROW(A1:A3)");
       String formula = range.getFormulaArray();
       
      Returns:
      The array formula of a range.
    • setFormulaArray

      void setFormulaArray(String value)
      Sets the array formula of a range.
      
       IRange range = worksheet.getRange("A1:A3");
       range.setFormulaArray("=ROW(A1:A3)");
       workbook.calculate();
       Object value = worksheet.getRange("A1").getValue();
       
      Parameters:
      value - The array formula of a range.
    • getFormulaArrayR1C1

      String getFormulaArrayR1C1()
      Gets the array formula of a range using ReferenceStyle.R1C1.
      
       IRange range = worksheet.getRange("A1:A3");
       range.setFormulaArrayR1C1("=ROW(R1C1:R3C1)");
       String formula = range.getFormulaArrayR1C1();
       
      Returns:
      The array formula of a range using ReferenceStyle.R1C1.
    • setFormulaArrayR1C1

      void setFormulaArrayR1C1(String value)
      Sets the array formula of a range using ReferenceStyle.R1C1.
      
       IRange range = worksheet.getRange("A1:A3");
       range.setFormulaArrayR1C1("=ROW(R1C1:R3C1)");
       workbook.calculate();
       Object value = worksheet.getRange("A1").getValue();
       
      Parameters:
      value - The array formula of a range using ReferenceStyle.R1C1.
    • getCurrentArray

      IRange getCurrentArray()
      Gets whether the specified cell is part of an array or dynamic array, returns an IRange object that represents the entire array.
      
       IRange arrayRange = worksheet.getRange("A1:A3");
       arrayRange.setFormulaArray("=ROW(A1:A3)");
       IRange currentArray = worksheet.getRange("A2").getCurrentArray();
       String address = currentArray.getAddress();
       
      Returns:
      Whether the specified cell is part of an array or dynamic array, returns an object that represents the entire array.
    • getHasFormula

      boolean getHasFormula()
      Returns true if the cell or range contains any formulas; otherwise, false is returned.
      
       IRange range = worksheet.getRange("A1");
       range.setFormula("=1+1");
       boolean hasFormula = range.getHasFormula();
       
      Returns:
      true if has formula is enabled; otherwise, false.
    • getHasArray

      boolean getHasArray()
      Determines if the specified cell is part of an array formula or dynamic array formula.
      
       IRange range = worksheet.getRange("A1:A3");
       range.setFormulaArray("=ROW(A1:A3)");
       boolean hasArray = worksheet.getRange("A1").getHasArray();
       
      Returns:
      true if has array is enabled; otherwise, false.
    • getValue

      Object getValue()
      Gets the value of the specified range as a string, double, boolean, Date, Object[][], or null.
      
       IRange range = worksheet.getRange("A1");
       range.setValue("Ready");
       Object value = range.getValue();
       
      Returns:
      The value of the specified range as a string, double, boolean, Date, Object[][], or null.
    • setValue

      void setValue(Object value)
      Sets the value of the specified cell as a string, double, int, boolean, Date, Calendar, Object[][] or null.
      
       IRange range = worksheet.getRange("A1:B2");
       range.setValue(new Object[][] {{"Name", "Score"}, {"Alice", 95}});
       Object value = worksheet.getRange("B2").getValue();
       
      Parameters:
      value - The value of the specified cell as a string, double, int, boolean, Date, Calendar, Object[][] or null.
    • setIgnoredError

      void setIgnoredError(EnumSet<IgnoredErrorType> value)
      Sets the error type of the range to be ignored.
      Parameters:
      value - The EnumSet of IgnoredErrorType.
      
       IRange range = worksheet.getRange("A1");
       range.setValue("\'123");
       range.setIgnoredError(EnumSet.of(IgnoredErrorType.NumberAsText));
       EnumSet<IgnoredErrorType> ignoredErrors = range.getIgnoredError();
       
    • getIgnoredError

      EnumSet<IgnoredErrorType> getIgnoredError()
      Gets the error type of the range to be ignored.
      Returns:
      The EnumSet of IgnoredErrorType.
      
       IRange range = worksheet.getRange("A1");
       range.setValue("\'123");
       range.setIgnoredError(EnumSet.of(IgnoredErrorType.NumberAsText));
       EnumSet<IgnoredErrorType> ignoredErrors = range.getIgnoredError();
       
    • getTag

      Object getTag()
      Gets the tag value of the specified range in the sheet.
      
       IRange range = worksheet.getRange("A1");
       range.setTag("customer-id");
       Object tag = range.getTag();
       
      Returns:
      The tag value of the specified range in the sheet.
    • setTag

      void setTag(Object value)
      Sets the tag value of the specified range in the sheet.
      
       IRange range = worksheet.getRange("A1");
       range.setTag("customer-id");
       Object tag = range.getTag();
       
      Parameters:
      value - The tag value of the specified range in the sheet.
    • getCellType

      BaseCellType getCellType()
      Gets the cell type for specified range in the sheet.
      
       ButtonCellType button = new ButtonCellType();
       button.setText("Submit");
       IRange range = worksheet.getRange("A1");
       range.setCellType(button);
       BaseCellType cellType = range.getCellType();
       
      Returns:
      The cell type for specified range in the sheet.
    • setCellType

      void setCellType(BaseCellType cellType)
      Sets the cell type for specified range in the sheet.
      
       ButtonCellType button = new ButtonCellType();
       button.setText("Submit");
       IRange range = worksheet.getRange("A1");
       range.setCellType(button);
       BaseCellType cellType = range.getCellType();
       
      Parameters:
      cellType - The cell type for specified range in the sheet.
    • getCellControl

      ICellControl getCellControl()
      Returns the ICellControl object that represents the cell control of the current range.
      Returns:
      The cell control object.
      
       IRange range = worksheet.getRange("A1:A3");
       range.getCellControl().setCheckbox();
       ICellControl cellControl = range.getCellControl();
       CellControlType controlType = cellControl.getType();
       
    • getBindingPath

      String getBindingPath()
      Gets the binding path of the current cell or column.

      For a regular range, this method returns the binding path of the top-left cell. For an entire column range, it returns the binding path of the leftmost column. For an entire row range, it returns null.

      
       IRange range = worksheet.getRange("A1");
       range.setBindingPath("Customer.Name");
       String bindingPath = range.getBindingPath();
       
      Returns:
      The binding path of the current cell or column.
    • setBindingPath

      void setBindingPath(String value)
      Sets the binding path of the current cell or column.

      For a regular range, this method sets the binding path of the top-left cell. For an entire column range, it sets the binding path of the leftmost column. For an entire row range, this method does nothing.

      
       IRange range = worksheet.getRange("A1");
       range.setBindingPath("Customer.Name");
       String bindingPath = range.getBindingPath();
       
      Parameters:
      value - The binding path of the current cell or column. For a regular range, sets the binding path of the top-left cell. For an entire column range, sets the binding path of the leftmost column. For an entire row range, does nothing.
    • getText

      String getText()
      Gets the value of the cell represented by this IRange as a formatted string.
      
       IRange range = worksheet.getRange("A1");
       range.setValue(1234.5);
       range.setNumberFormat("$#,##0.00");
       String text = range.getText();
       
      Returns:
      The value of the cell represented by this IRange as a formatted string.
    • getAreas

      IAreas getAreas()
      Returns an instance of IAreas which represents an array of ranges where each range returned by areas represents one cell or range.
      
       IRange range = worksheet.getRange("A1,C3");
       IAreas areas = range.getAreas();
       int areaCount = areas.getAreaCount();
       
      Returns:
      An IAreas instance containing each cell or range area in this range; see IAreas.
    • getUsedRange

      IRange getUsedRange()
      Returns an IRange representing the used range in the current range.
      
       worksheet.getRange("B2").setValue("Used cell");
       IRange usedRange = worksheet.getRange("A1:C5").getUsedRange();
       String address = usedRange.getAddress();
       
      Returns:
      An IRange representing the used range in the current range.
    • getUsedRange

      IRange getUsedRange(EnumSet<UsedRangeType> type)
      Returns an IRange representing the used range in the current range.
      
       worksheet.getRange("B2").setValue("Used cell");
       worksheet.getRange("C3").getInterior().setColor(Color.GetYellow());
       IRange usedRange = worksheet.getRange("A1:C5").getUsedRange(EnumSet.of(UsedRangeType.Data));
       String address = usedRange.getAddress();
       
      Parameters:
      type - The feature type.
      Returns:
      An IRange representing the used range in the current range.
    • get

      IRange get(int rowOffset, int columnOffset)
      Returns a new instance of IRange which is offset from this range.
      Parameters:
      rowOffset - The row offset.
      columnOffset - The column offset.
      Returns:
      IRange.
      
       IRange range = worksheet.getRange("B2:C3");
       IRange cell = range.get(1, 1);
       cell.setValue("C3");
       Object value = worksheet.getRange("C3").getValue();
       
    • get

      IRange get(int index)
      Returns a new instance of IRange by index which represents a cell.
      Parameters:
      index - The index of the range.
      Returns:
      A new instance of by index which represents a cell.
      
       IRange range = worksheet.getRange("B2:C3");
       IRange cell = range.get(2);
       cell.setValue("Selected cell");
       Object value = cell.getValue();
       
    • getMergeCells

      boolean getMergeCells()
      Gets the property which specifies whether cells are merged.
      
       IRange range = worksheet.getRange("A1:B2");
       range.merge();
       boolean mergeCells = range.getMergeCells();
       
      Returns:
      true if merge cells is enabled; otherwise, false.
    • setMergeCells

      void setMergeCells(boolean value)
      Sets the property which specifies whether cells are merged.
      
       IRange range = worksheet.getRange("A1:B2");
       range.setMergeCells(true);
       boolean mergeCells = range.getMergeCells();
       
      Parameters:
      value - Whether cells are merged.
    • merge

      void merge()
      Merges the cells in the represented range into a single merged cell.
      
       IRange range = worksheet.getRange("A1:B2");
       range.merge();
       boolean mergeCells = range.getMergeCells();
       
    • merge

      void merge(boolean isAcross)
      Merges the cells in the represented range into a single merged cell.
      Parameters:
      isAcross - Optional Object. True to merge cells in each row of the specified range as separate merged cells. The default value is False.
      
       IRange range = worksheet.getRange("A1:B2");
       range.merge(true);
       boolean firstRowMerged = worksheet.getRange("A1:B1").getMergeCells();
       
    • unmerge

      void unmerge()
      Converts merged cells in the represented range to normal cells.
      
       IRange range = worksheet.getRange("A1:B2");
       range.merge();
       range.unmerge();
       boolean mergeCells = range.getMergeCells();
       
    • insert

      void insert()
      Inserts a cell or a range of cells into the worksheet and shifts other cells away to make space.
      
       worksheet.getRange("A1").setValue("First");
       worksheet.getRange("A1").insert();
       Object value = worksheet.getRange("A2").getValue();
       
    • insert

      void insert(InsertShiftDirection shiftDirection)
      Inserts a cell or a range of cells into the worksheet and shifts other cells away to make space.
      Parameters:
      shiftDirection - Specifies which way to shift the cells.
      
       worksheet.getRange("A1").setValue("First");
       worksheet.getRange("A1").insert(InsertShiftDirection.Down);
       Object value = worksheet.getRange("A2").getValue();
       
    • delete

      void delete()
      Deletes a cell or a range of cells from the worksheet and shifts other cells to replace deleted cells.
      
       worksheet.getRange("A1").setValue("Delete me");
       worksheet.getRange("A2").setValue("Keep me");
       worksheet.getRange("A1").delete();
       Object value = worksheet.getRange("A1").getValue();
       
    • delete

      void delete(DeleteShiftDirection shiftDirection)
      Deletes a cell or a range of cells from the worksheet and shifts other cells to replace deleted cells.
      Parameters:
      shiftDirection - Specifies which way to shift the cells.
      
       worksheet.getRange("A1").setValue("Delete me");
       worksheet.getRange("A2").setValue("Keep me");
       worksheet.getRange("A1").delete(DeleteShiftDirection.Up);
       Object value = worksheet.getRange("A1").getValue();
       
    • clear

      void clear()
      Clears formulas, values, and all formatting from the current range.
      
       IRange range = worksheet.getRange("A1");
       range.setValue("Clear me");
       range.getInterior().setColor(Color.GetYellow());
       range.clear();
       Object value = range.getValue();
       
    • clearContents

      void clearContents()
      Clears formulas and values from the current range.
      
       IRange range = worksheet.getRange("A1");
       range.setValue("Clear me");
       range.getInterior().setColor(Color.GetYellow());
       range.clearContents();
       Object value = range.getValue();
       
    • clearFormats

      void clearFormats()
      Clears all formatting from the current range.
      
       IRange range = worksheet.getRange("A1");
       range.setValue("Keep value");
       range.getInterior().setColor(Color.GetYellow());
       range.clearFormats();
       Object value = range.getValue();
       
    • clearHyperlinks

      void clearHyperlinks()
      Clears all hyperLinks from the current range.
      
       IRange range = worksheet.getRange("A1");
       range.getHyperlinks().add(range, "https://www.example.com");
       range.clearHyperlinks();
       int hyperlinkCount = range.getHyperlinks().getCount();
       
    • clearComments

      void clearComments()
      Clears the comments from the current range.
      
       IRange range = worksheet.getRange("A1");
       range.addComment("Review this value.");
       range.clearComments();
       IComment comment = range.getComment();
       
    • clearCommentsThreaded

      void clearCommentsThreaded()
      Clears the threaded comments from the current range.
      
       IRange range = worksheet.getRange("A1");
       range.addCommentThreaded("Review this value.", "Alex");
       range.clearCommentsThreaded();
       ICommentThreaded comment = range.getCommentThreaded();
       
    • removeControls

      void removeControls()
      Removes cell controls from the current range.
      
       IRange range = worksheet.getRange("A1");
       range.getCellControl().setCheckbox();
       range.removeControls();
       CellControlType controlType = range.getCellControl().getType();
       
    • addComment

      IComment addComment(String text)
      Adds comments to the current range.
      Parameters:
      text - The text you want to add.
      Returns:
      The created IComment object.
      
       IRange range = worksheet.getRange("A1");
       IComment comment = range.addComment("Review this value.");
       String text = comment.getText();
       
    • sort

      void sort(SortOrientation orientation, boolean caseSensitive, IValueSortField... keys)
      Sorts the cells represented by this range according to the specified options.
      Parameters:
      orientation - The orientation.
      caseSensitive - if set to true, case sensitive.
      keys - The IValueSortField array.
      
       worksheet.getRange("A1:B4").setValue(new Object[][] {
           {"Name", "Score"},
           {"Alice", 95},
           {"Bob", 70},
           {"Carol", 88}
       });
       ValueSortField key = new ValueSortField(worksheet.getRange("B2:B4"));
       worksheet.getRange("A2:B4").sort(SortOrientation.Columns, false, key);
       Object firstScore = worksheet.getRange("B2").getValue();
       
    • sort

      void sort(IRange key, SortOrder order, SortOrientation orientation, boolean caseSensitive)
      Sorts the cells represented by this range according to the specified options.
      Parameters:
      key - The key of the sort column.
      order - The sort order, ascending or descending
      orientation - The orientation.
      caseSensitive - if set to true, case sensitive.
      
       worksheet.getRange("A1:B4").setValue(new Object[][] {
           {"Name", "Score"},
           {"Alice", 95},
           {"Bob", 70},
           {"Carol", 88}
       });
       worksheet.getRange("A2:B4").sort(worksheet.getRange("B2:B4"), SortOrder.Ascending, SortOrientation.Columns, false);
       Object firstScore = worksheet.getRange("B2").getValue();
       
    • sort

      void sort(IRange key, SortOrder order, SortOrientation orientation)
      Sorts the cells represented by this range according to the specified options.
      Parameters:
      key - The key of the sort column.
      order - The sort order, ascending or dscending
      orientation - The orientation.
      
       worksheet.getRange("A1:B4").setValue(new Object[][] {
           {"Name", "Score"},
           {"Alice", 95},
           {"Bob", 70},
           {"Carol", 88}
       });
       worksheet.getRange("A2:B4").sort(worksheet.getRange("B2:B4"), SortOrder.Ascending, SortOrientation.Columns);
       Object firstScore = worksheet.getRange("B2").getValue();
       
    • autoFilter

      void autoFilter(int field, Object criteria1, AutoFilterOperator op, Object criteria2, boolean visibleDropDown)
      Filters a list using the AutoFilter.
      Parameters:
      field - Optional Object. The integer offset of the field on which you want to base the filter (from the left of the list; the leftmost field is field zero).
      criteria1 - Optional Object. The criteria (a string; for example,"101"). Use "=" to find blank fields, or use " <> " to find nonblank fields. If this argument is omitted, the criteria is All. If Operator is AutoFilterOperator.Top10Items, Criteria1 specifies the number of items (for example, "10").
      op - Optional AutoFilterOperator
      criteria2 - Optional Object. The second criteria (a string). Used with Criteria1 and Operator to construct compound criteria.
      visibleDropDown - Optional Object. True to display the AutoFilter drop-down arrow for the filtered field; False to hide the AutoFilter drop-down arrow for the filtered field. True by default.
      
       worksheet.getRange("A1:B4").setValue(new Object[][] {
           {"Name", "Score"},
           {"Alice", 95},
           {"Bob", 70},
           {"Carol", 88}
       });
       worksheet.getRange("A1:B4").autoFilter(1, ">=80", AutoFilterOperator.And, "<=100", true);
       boolean hidden = worksheet.getRange("3:3").getHidden();
       
    • autoFilter

      void autoFilter(int field)
      Filters a list using the AutoFilter.
      Parameters:
      field - Optional Object. The integer offset of the field on which you want to base the filter (from the left of the list; the leftmost field is field zero).
      
       worksheet.getRange("A1:B4").setValue(new Object[][] {
           {"Name", "Score"},
           {"Alice", 95},
           {"Bob", 70},
           {"Carol", 88}
       });
       worksheet.getRange("A1:B4").autoFilter(1);
       IRange filterRange = worksheet.getAutoFilter().getRange();
       
    • autoFilter

      void autoFilter()
      Filters a list using the AutoFilter.
      Add a filter with no condition if there's no filter in the sheet.
      Or show all the data in the first column of the filter.
      
       worksheet.getRange("A1:B4").setValue(new Object[][] {
           {"Name", "Score"},
           {"Alice", 95},
           {"Bob", 70},
           {"Carol", 88}
       });
       worksheet.getRange("A1:B4").autoFilter();
       IRange filterRange = worksheet.getAutoFilter().getRange();
       
    • autoFilter

      void autoFilter(int field, Object criteria1)
      Filters a list using the AutoFilter.
      Parameters:
      field - Optional Object. The integer offset of the field on which you want to base the filter (from the left of the list; the leftmost field is field zero).
      criteria1 - Optional Object. The criteria (a string; for example,"101"). Use "=" to find blank fields, or use " <> " to find nonblank fields. If this argument is omitted, the criteria is All. If Operator is AutoFilterOperator.Top10Items, Criteria1 specifies the number of items (for example, "10").
      
       worksheet.getRange("A1:B4").setValue(new Object[][] {
           {"Name", "Score"},
           {"Alice", 95},
           {"Bob", 70},
           {"Carol", 88}
       });
       worksheet.getRange("A1:B4").autoFilter(1, ">=90");
       boolean hidden = worksheet.getRange("3:3").getHidden();
       
    • autoFilter

      void autoFilter(int field, Object criteria1, AutoFilterOperator op)
      Filters a list using the AutoFilter.
      Parameters:
      field - Optional Object. The integer offset of the field on which you want to base the filter (from the left of the list; the leftmost field is field zero).
      criteria1 - Optional Object. The criteria (a string; for example,"101"). Use "=" to find blank fields, or use " <> " to find nonblank fields. If this argument is omitted, the criteria is All. If Operator is AutoFilterOperator.Top10Items, Criteria1 specifies the number of items (for example, "10").
      op - Optional AutoFilterOperator
      
       worksheet.getRange("A1:B4").setValue(new Object[][] {
           {"Name", "Score"},
           {"Alice", 95},
           {"Bob", 70},
           {"Carol", 88}
       });
       worksheet.getRange("A1:B4").autoFilter(1, "2", AutoFilterOperator.Top10Items);
       IRange filterRange = worksheet.getAutoFilter().getRange();
       
    • autoFilter

      void autoFilter(int field, Object criteria1, AutoFilterOperator op, Object criteria2)
      Filters a list using the AutoFilter.
      Parameters:
      field - Optional Object. The integer offset of the field on which you want to base the filter (from the left of the list; the leftmost field is field zero).
      criteria1 - Optional Object. The criteria (a string; for example,"101"). Use "=" to find blank fields, or use " <> " to find nonblank fields. If this argument is omitted, the criteria is All. If Operator is AutoFilterOperator.Top10Items, Criteria1 specifies the number of items (for example, "10").
      op - Optional AutoFilterOperator
      criteria2 - Optional Object. The second criteria (a string). Used with Criteria1 and Operator to construct compound criteria.
      
       worksheet.getRange("A1:B4").setValue(new Object[][] {
           {"Name", "Score"},
           {"Alice", 95},
           {"Bob", 70},
           {"Carol", 88}
       });
       worksheet.getRange("A1:B4").autoFilter(1, ">=80", AutoFilterOperator.And, "<=100");
       boolean hidden = worksheet.getRange("3:3").getHidden();
       
    • autoFilter

      void autoFilter(boolean isFirstRowData, int field, Object criteria1, AutoFilterOperator op, Object criteria2, boolean visibleDropDown)
      Filters a list using the AutoFilter.
      Parameters:
      isFirstRowData - Indicates whether the first row of the selection area participates in filtering. When set to true, the behavior is consistent with SpreadJS; when false, it is consistent with Microsoft Excel.
      field - Optional Object. The integer offset of the field on which you want to base the filter (from the left of the list; the leftmost field is field zero).
      criteria1 - Optional Object. The criteria (a string; for example,"101"). Use "=" to find blank fields, or use " <> " to find nonblank fields. If this argument is omitted, the criteria is All. If Operator is AutoFilterOperator.Top10Items, Criteria1 specifies the number of items (for example, "10").
      op - Optional AutoFilterOperator
      criteria2 - Optional Object. The second criteria (a string). Used with Criteria1 and Operator to construct compound criteria.
      visibleDropDown - Optional Object. True to display the AutoFilter drop-down arrow for the filtered field; False to hide the AutoFilter drop-down arrow for the filtered field. True by default.
      
       worksheet.getRange("A1:B4").setValue(new Object[][] {
           {"Name", "Score"},
           {"Alice", 95},
           {"Bob", 70},
           {"Carol", 88}
       });
       worksheet.getRange("A2:B4").autoFilter(true, 1, ">=80", AutoFilterOperator.And, "<=100", true);
       IRange filterRange = worksheet.getAutoFilter().getRange();
       
    • autoFilter

      void autoFilter(boolean isFirstRowData)
      Filters a list using the AutoFilter.
      Add a filter with no condition if there's no filter in the sheet.
      Or show all the data in the first column of the filter.
      Parameters:
      isFirstRowData - Indicates whether the first row of the selection area participates in filtering. When set to true, the behavior is consistent with SpreadJS; when false, it is consistent with Microsoft Excel.
      
       worksheet.getRange("A1:B4").setValue(new Object[][] {
           {"Name", "Score"},
           {"Alice", 95},
           {"Bob", 70},
           {"Carol", 88}
       });
       worksheet.getRange("A2:B4").autoFilter(true);
       IRange filterRange = worksheet.getAutoFilter().getRange();
       
    • autoFilter

      void autoFilter(boolean isFirstRowData, int field)
      Filters a list using the AutoFilter.
      Parameters:
      isFirstRowData - Indicates whether the first row of the selection area participates in filtering. When set to true, the behavior is consistent with SpreadJS; when false, it is consistent with Microsoft Excel.
      field - Optional Object. The integer offset of the field on which you want to base the filter (from the left of the list; the leftmost field is field zero).
      
       worksheet.getRange("A1:B4").setValue(new Object[][] {
           {"Name", "Score"},
           {"Alice", 95},
           {"Bob", 70},
           {"Carol", 88}
       });
       worksheet.getRange("A2:B4").autoFilter(true, 1);
       IRange filterRange = worksheet.getAutoFilter().getRange();
       
    • autoFilter

      void autoFilter(boolean isFirstRowData, int field, Object criteria1)
      Filters a list using the AutoFilter.
      Parameters:
      isFirstRowData - Indicates whether the first row of the selection area participates in filtering. When set to true, the behavior is consistent with SpreadJS; when false, it is consistent with Microsoft Excel.
      field - Optional Object. The integer offset of the field on which you want to base the filter (from the left of the list; the leftmost field is field zero).
      criteria1 - Optional Object. The criteria (a string; for example,"101"). Use "=" to find blank fields, or use " <> " to find nonblank fields. If this argument is omitted, the criteria is All. If Operator is AutoFilterOperator.Top10Items, Criteria1 specifies the number of items (for example, "10").
      
       worksheet.getRange("A1:B4").setValue(new Object[][] {
           {"Name", "Score"},
           {"Alice", 95},
           {"Bob", 70},
           {"Carol", 88}
       });
       worksheet.getRange("A2:B4").autoFilter(true, 1, ">=90");
       IRange filterRange = worksheet.getAutoFilter().getRange();
       
    • autoFilter

      void autoFilter(boolean isFirstRowData, int field, Object criteria1, AutoFilterOperator op)
      Filters a list using the AutoFilter.
      Parameters:
      isFirstRowData - Indicates whether the first row of the selection area participates in filtering. When set to true, the behavior is consistent with SpreadJS; when false, it is consistent with Microsoft Excel.
      field - Optional Object. The integer offset of the field on which you want to base the filter (from the left of the list; the leftmost field is field zero).
      criteria1 - Optional Object. The criteria (a string; for example,"101"). Use "=" to find blank fields, or use " <> " to find nonblank fields. If this argument is omitted, the criteria is All. If Operator is AutoFilterOperator.Top10Items, Criteria1 specifies the number of items (for example, "10").
      op - Optional AutoFilterOperator
      
       worksheet.getRange("A1:B4").setValue(new Object[][] {
           {"Name", "Score"},
           {"Alice", 95},
           {"Bob", 70},
           {"Carol", 88}
       });
       worksheet.getRange("A2:B4").autoFilter(true, 1, "2", AutoFilterOperator.Top10Items);
       IRange filterRange = worksheet.getAutoFilter().getRange();
       
    • autoFilter

      void autoFilter(boolean isFirstRowData, int field, Object criteria1, AutoFilterOperator op, Object criteria2)
      Filters a list using the AutoFilter.
      Parameters:
      isFirstRowData - Indicates whether the first row of the selection area participates in filtering. When set to true, the behavior is consistent with SpreadJS; when false, it is consistent with Microsoft Excel.
      field - Optional Object. The integer offset of the field on which you want to base the filter (from the left of the list; the leftmost field is field zero).
      criteria1 - Optional Object. The criteria (a string; for example,"101"). Use "=" to find blank fields, or use " <> " to find nonblank fields. If this argument is omitted, the criteria is All. If Operator is AutoFilterOperator.Top10Items, Criteria1 specifies the number of items (for example, "10").
      op - Optional AutoFilterOperator
      criteria2 - Optional Object. The second criteria (a string). Used with Criteria1 and Operator to construct compound criteria.
      
       worksheet.getRange("A1:B4").setValue(new Object[][] {
           {"Name", "Score"},
           {"Alice", 95},
           {"Bob", 70},
           {"Carol", 88}
       });
       worksheet.getRange("A2:B4").autoFilter(true, 1, ">=80", AutoFilterOperator.And, "<=100");
       IRange filterRange = worksheet.getAutoFilter().getRange();
       
    • getWidth

      double getWidth()
      Gets the width, in points, of the range.
      
       IRange range = worksheet.getRange("A1:B1");
       double width = range.getWidth();
       
      Returns:
      The width, in points, of the range.
    • getWidthInPixel

      double getWidthInPixel()
      Gets the width, in pixels, of the range.
      
       IRange range = worksheet.getRange("A1:B1");
       double widthInPixel = range.getWidthInPixel();
       
      Returns:
      The width, in pixels, of the range.
    • getColumnWidth

      double getColumnWidth()
      Gets the width of the individual columns represented in this range in characters.
      
       IRange range = worksheet.getRange("A:A");
       range.setColumnWidth(20);
       double columnWidth = range.getColumnWidth();
       
      Returns:
      The width of the individual columns represented in this range in characters.
    • setColumnWidth

      void setColumnWidth(double value)
      Sets the width of the individual columns represented in this range in characters.
      
       IRange range = worksheet.getRange("A:A");
       range.setColumnWidth(20);
       double columnWidth = range.getColumnWidth();
       
      Parameters:
      value - The width of the individual columns represented in this range in characters.
    • getColumnWidthInPixel

      double getColumnWidthInPixel()
      Gets the width of the individual columns represented in this range in pixels.
      
       IRange range = worksheet.getRange("A:A");
       range.setColumnWidthInPixel(120);
       double columnWidthInPixel = range.getColumnWidthInPixel();
       
      Returns:
      The width of the individual columns represented in this range in pixels.
    • setColumnWidthInPixel

      void setColumnWidthInPixel(double value)
      Sets the width of the individual columns represented in this range in pixels.
      
       IRange range = worksheet.getRange("A:A");
       range.setColumnWidthInPixel(120);
       double columnWidthInPixel = range.getColumnWidthInPixel();
       
      Parameters:
      value - The width of the individual columns represented in this range in pixels.
    • getHeight

      double getHeight()
      Gets the height, in points, of the range.
      
       IRange range = worksheet.getRange("1:2");
       double height = range.getHeight();
       
      Returns:
      The height, in points, of the range.
    • getHeightInPixel

      double getHeightInPixel()
      Gets the height, in pixels, of the range.
      
       IRange range = worksheet.getRange("1:2");
       double heightInPixel = range.getHeightInPixel();
       
      Returns:
      The height, in pixels, of the range.
    • getRowHeight

      double getRowHeight()
      Gets the height of the individual rows represented by this range in points.
      
       IRange range = worksheet.getRange("1:1");
       range.setRowHeight(30);
       double rowHeight = range.getRowHeight();
       
      Returns:
      The height of the individual rows represented by this range in points.
    • setRowHeight

      void setRowHeight(double value)
      Sets the height of the individual rows represented by this range in points.
      
       IRange range = worksheet.getRange("1:1");
       range.setRowHeight(30);
       double rowHeight = range.getRowHeight();
       
      Parameters:
      value - The height of the individual rows represented by this range in points.
    • getRowHeightInPixel

      double getRowHeightInPixel()
      Gets the height of the individual rows represented by this range in pixels.
      
       IRange range = worksheet.getRange("1:1");
       range.setRowHeightInPixel(40);
       double rowHeightInPixel = range.getRowHeightInPixel();
       
      Returns:
      The height of the individual rows represented by this range in pixels.
    • setRowHeightInPixel

      void setRowHeightInPixel(double value)
      Sets the height of the individual rows represented by this range in pixels.
      
       IRange range = worksheet.getRange("1:1");
       range.setRowHeightInPixel(40);
       double rowHeightInPixel = range.getRowHeightInPixel();
       
      Parameters:
      value - The height of the individual rows represented by this range in pixels.
    • getFormatConditions

      IFormatConditions getFormatConditions()
      Returns a FormatConditions collection that represents all the conditional formats for the specified range.
      
       IRange range = worksheet.getRange("A1:A3");
       IFormatConditions conditions = range.getFormatConditions();
       conditions.addAboveAverage();
       int count = conditions.getCount();
       
      Returns:
      A FormatConditions collection that represents all the conditional formats for the specified range.
    • clearOutline

      void clearOutline()
      Clears the outline for the specified range.
      
       worksheet.getRange("2:4").group();
       IRange range = worksheet.getRange("2:4");
       range.clearOutline();
       int outlineLevel = range.getOutlineLevel();
       
    • group

      void group()
      Increments the OutlineLevel of the specified rows or columns.
      
       IRange range = worksheet.getRange("2:4");
       range.group();
       int outlineLevel = range.getOutlineLevel();
       
    • ungroup

      void ungroup()
      Decrements the OutlineLevel of the specified rows or columns.
      
       worksheet.getRange("2:4").group();
       IRange range = worksheet.getRange("2:4");
       range.ungroup();
       int outlineLevel = range.getOutlineLevel();
       
    • getOutlineLevel

      int getOutlineLevel()
      Gets the current outline level of the specified row or column.
      
       worksheet.getRange("2:4").group();
       IRange range = worksheet.getRange("2:4");
       int outlineLevel = range.getOutlineLevel();
       
      Returns:
      The current outline level of the specified row or column.
    • setOutlineLevel

      void setOutlineLevel(int value)
      Sets the current outline level of the specified row or column.
      
       IRange range = worksheet.getRange("2:4");
       range.setOutlineLevel(2);
       int outlineLevel = range.getOutlineLevel();
       
      Parameters:
      value - The current outline level of the specified row or column.
    • getShowDetail

      boolean getShowDetail()
      Gets whether to show the detail (True if the outline is expanded for the specified range, so that the detail of the column or row is visible). The specified range must be a single summary column or row in an outline.

      The following statements are true: 1.The range must be in a single summary row or column. 2.This property returns False if any of the children of the row or column are hidden. 3.Setting this property to True is equivalent to unhiding all the children of the summary row or column. 4.Setting this property to False is equivalent to hiding all the children of the summary row or column.

      
       worksheet.getRange("2:4").group();
       IRange summaryRow = worksheet.getRange("5:5");
       boolean showDetail = summaryRow.getShowDetail();
       
      Returns:
      true if to show the detail (True if the outline is expanded for the specified range, so that the detail of the column or row is visible); otherwise, false.
    • setShowDetail

      void setShowDetail(boolean value)
      Sets whether to show the detail (True if the outline is expanded for the specified range, so that the detail of the column or row is visible). The specified range must be a single summary column or row in an outline.

      The following statements are true: 1.The range must be in a single summary row or column. 2.This property returns False if any of the children of the row or column are hidden. 3.Setting this property to True is equivalent to unhiding all the children of the summary row or column. 4.Setting this property to False is equivalent to hiding all the children of the summary row or column.

      
       worksheet.getRange("2:4").group();
       IRange summaryRow = worksheet.getRange("5:5");
       summaryRow.setShowDetail(false);
       boolean hidden = worksheet.getRange("2:2").getHidden();
       
      Parameters:
      value - Whether to show the detail (True if the outline is expanded for the specified range, so that the detail of the column or row is visible). The specified range must be a single summary column or row in an outline.
    • getSummary

      boolean getSummary()
      Determines if the range is an outlining summary row or column.
      
       worksheet.getRange("2:4").group();
       boolean summary = worksheet.getRange("5:5").getSummary();
       
      Returns:
      true if summary is enabled; otherwise, false.
    • activate

      void activate()
      Activates a single cell, which must be inside the current selection.
      
       worksheet.getRange("B2").select();
       worksheet.getRange("B2").activate();
       IRange activeCell = worksheet.getActiveCell();
       
    • select

      void select()
      Selects the object.
      
       IRange range = worksheet.getRange("A1:B2");
       range.select();
       IRange selection = worksheet.getSelection();
       
    • copy

      void copy(IRange destination)
      Copies the range to the specified range.
      
       worksheet.getRange("A1").setValue("Copy me");
       worksheet.getRange("A1").copy(worksheet.getRange("B1"));
       Object value = worksheet.getRange("B1").getValue();
       
      Parameters:
      destination - The destination range.
    • copy

      @Deprecated void copy(IRange destination, EnumSet<PasteType> pasteType)
      Deprecated.
      Please use the copy(IRange,PasteOption) overload instead.
      Copies the range to the specified range.
      Parameters:
      destination - Specifies the new range to which the specified range will be pasted. It can be the range of the same or another workbook.
      pasteType - Specifies the part of the range to be pasted.
    • copy

      void copy(IRange destination, PasteOption pasteOption)
      Copies the range to the specified range.
      Parameters:
      destination - Specifies the new range to which the specified range will be pasted. It can be the range of the same or another workbook.
      pasteOption - Specifies the part of the range to be pasted and whether to include hidden range.
      
       worksheet.getRange("A1").setFormula("=1+1");
       PasteOption option = new PasteOption();
       option.setPasteType(EnumSet.of(PasteType.Values));
       worksheet.getRange("A1").copy(worksheet.getRange("B1"), option);
       Object value = worksheet.getRange("B1").getValue();
       
    • cut

      void cut(IRange destination)
      Cuts the range to the specified range.
      Parameters:
      destination - Specifies the new range to which the specified range will be pasted. It can be the range of the same or another workbook.
      
       worksheet.getRange("A1").setValue("Move me");
       worksheet.getRange("A1").cut(worksheet.getRange("B1"));
       Object value = worksheet.getRange("B1").getValue();
       
    • getHasValidation

      boolean getHasValidation()
      Returns true if any of the cells represented by this range have data validation associated with them.
      
       IRange range = worksheet.getRange("A1");
       range.getValidation().add(ValidationType.Whole, ValidationAlertStyle.Stop, ValidationOperator.Between, 1, 10);
       boolean hasValidation = range.getHasValidation();
       
      Returns:
      true if has validation is enabled; otherwise, false.
    • getValidationIsSame

      boolean getValidationIsSame()
      Returns true if the validation options of all cells represented by this IRange are the same; otherwise, false is returned.
      
       IRange range = worksheet.getRange("A1:A2");
       range.getValidation().add(ValidationType.Whole, ValidationAlertStyle.Stop, ValidationOperator.Between, 1, 10);
       boolean validationIsSame = range.getValidationIsSame();
       
      Returns:
      true if validation is same is enabled; otherwise, false.
    • getUseStandardHeight

      boolean getUseStandardHeight()
      Gets whether the row height of the IRange object equals the standard height of the sheet.
      
       IRange row = worksheet.getRange("1:1");
       row.setUseStandardHeight(true);
       boolean useStandardHeight = row.getUseStandardHeight();
       
      Returns:
      true if the row height of the object equals the standard height of the sheet; otherwise, false.
    • setUseStandardHeight

      void setUseStandardHeight(boolean value)
      Sets whether the row height of the IRange object equals the standard height of the sheet.
      
       IRange row = worksheet.getRange("1:1");
       row.setRowHeight(30);
       row.setUseStandardHeight(true);
       boolean useStandardHeight = row.getUseStandardHeight();
       
      Parameters:
      value - Whether the row height of the IRange object equals the standard height of the sheet.
    • getUseStandardWidth

      boolean getUseStandardWidth()
      Gets whether the column width of the IRange object equals the standard width of the sheet.
      
       IRange column = worksheet.getRange("A:A");
       column.setUseStandardWidth(true);
       boolean useStandardWidth = column.getUseStandardWidth();
       
      Returns:
      true if the column width of the object equals the standard width of the sheet; otherwise, false.
    • setUseStandardWidth

      void setUseStandardWidth(boolean value)
      Sets whether the column width of the IRange object equals the standard width of the sheet.
      
       IRange column = worksheet.getRange("A:A");
       column.setColumnWidth(20);
       column.setUseStandardWidth(true);
       boolean useStandardWidth = column.getUseStandardWidth();
       
      Parameters:
      value - Whether the column width of the IRange object equals the standard width of the sheet.
    • calculate

      void calculate()
      Calculates formulas of the range as needed.
      
       worksheet.getRange("A1").setValue(10);
       IRange formulaCell = worksheet.getRange("B1");
       formulaCell.setFormula("=A1*2");
       formulaCell.calculate();
       Object value = formulaCell.getValue();
       
    • dirty

      void dirty()
      Designates all the formulas of the range to be recalculated when the next calculation occurs.
      
       IRange formulaCell = worksheet.getRange("B1");
       worksheet.getRange("A1").setValue(10);
       formulaCell.setFormula("=A1*2");
       formulaCell.dirty();
       formulaCell.calculate();
       Object value = formulaCell.getValue();
       
    • isRichText

      boolean isRichText()
      Indicates whether the cell string value is a rich text.
      
       IRichText richText = worksheet.getRange("A1").getRichText();
       richText.add("Document ").getFont().setBold(true);
       richText.add("Solutions");
       boolean richTextCell = worksheet.getRange("A1").isRichText();
       
      Returns:
      true if the cell string value is a rich text; otherwise, false.
    • getRichText

      IRichText getRichText()
      Gets the rich text object associate with the top-left cell of this range.
      
       IRichText richText = worksheet.getRange("A1").getRichText();
       richText.add("Document ").getFont().setBold(true);
       richText.add("Solutions");
       String plainText = richText.getPlainText();
       
      Returns:
      The rich text object associate with the top-left cell of this range.
    • characters

      ITextRun characters(int startIndex, int length)
      Returns a ITextRun object that represents a range of characters within the cell text.
      
       worksheet.getRange("A1").setValue("Document Solutions");
       ITextRun run = worksheet.getRange("A1").characters(1, 8);
       run.getFont().setBold(true);
       String text = run.getText();
       
      Parameters:
      startIndex - The one-based index of the first character.
      length - The number of characters to return.
      Returns:
      A ITextRun object that represents a range of characters within the cell text.
    • find

      IRange find(Object what, IRange after, FindOptions options)
      Finds specific information in a range.
      Parameters:
      what - The data to search for. Can be a String, double, Date, Calendar, boolean or int.
      after - The cell after which you want the search to begin. This corresponds to the position of the active cell when a search is done from the user interface. Notice that After must be a single cell in the range. Remember that the search begins after this cell; the specified cell isn't searched until the method wraps back around to this cell. If you do not specify this argument, the search starts at the cell in the upper-left corner of the range when FindOptions.SearchDirection is SearchDirection.Next, or at the cell in the bottom-right corner of the range when FindOptions.SearchDirection is SearchDirection.Previous.
      options - The find options
      Returns:
      A IRange object that represents the first cell where that information is found.
      
       worksheet.getRange("A1:A3").setValue(new Object[][] {{"Alpha"}, {"Beta"}, {"Gamma"}});
       FindOptions options = new FindOptions();
       options.setLookAt(LookAt.Whole);
       IRange found = worksheet.getRange("A1:A3").find("Beta", worksheet.getRange("A1"), options);
       
    • find

      IRange find(Object what, IRange after)
      Finds specific information in a range.
      Parameters:
      what - The data to search for. Can be a String, double, Date, LocalDateTime, Calendar, boolean or int.
      after - The cell after which you want the search to begin. This corresponds to the position of the active cell when a search is done from the user interface. Notice that After must be a single cell in the range. Remember that the search begins after this cell; the specified cell isn't searched until the method wraps back around to this cell. If you do not specify this argument, the search starts at the cell in the upper-left corner of the range when FindOptions.SearchDirection is SearchDirection.Next, or at the cell in the bottom-right corner of the range when FindOptions.SearchDirection is SearchDirection.Previous.
      Returns:
      A IRange object that represents the first cell where that information is found.
      
       worksheet.getRange("A1:A3").setValue(new Object[][] {{"Alpha"}, {"Beta"}, {"Gamma"}});
       IRange found = worksheet.getRange("A1:A3").find("Beta", worksheet.getRange("A1"));
       
    • find

      IRange find(Object what)
      Finds specific information in a range, starts from the upper-left corner.
      Parameters:
      what - The data to search for. Can be a String, double, Date, LocalDateTime, Calendar, boolean or int.
      Returns:
      A IRange object that represents the first cell where that information is found.
      
       worksheet.getRange("A1:A3").setValue(new Object[][] {{"Alpha"}, {"Beta"}, {"Gamma"}});
       IRange found = worksheet.getRange("A1:A3").find("Beta");
       
    • find

      IRange find(Object what, FindOptions options)
      Finds specific information in a range, starts from the upper-left corner.
      Parameters:
      what - The data to search for. Can be a String, double, Date, LocalDateTime, Calendar, boolean or int.
      options - The find options
      Returns:
      A IRange object that represents the first cell where that information is found.
      
       worksheet.getRange("A1:A3").setValue(new Object[][] {{"Alpha"}, {"Beta"}, {"Gamma"}});
       FindOptions options = new FindOptions();
       options.setLookAt(LookAt.Whole);
       IRange found = worksheet.getRange("A1:A3").find("Beta", options);
       
    • replace

      int replace(Object what, Object replacement)
      Search in formulas and replace. Using this method doesn't change either the selection or the active cell.
      Parameters:
      what - The string you want to search for.
      replacement - The replacement string.
      Returns:
      Number of cells that was replaced.
      
       worksheet.getRange("A1:A2").setValue(new Object[][] {{"North"}, {"North"}});
       int replacedCount = worksheet.getRange("A1:A2").replace("North", "East");
       Object value = worksheet.getRange("A1").getValue();
       
    • replace

      int replace(Object what, Object replacement, ReplaceOptions options)
      Search in formulas and replace. Using this method doesn't change either the selection or the active cell.
      Parameters:
      what - The string you want to search for.
      replacement - The replacement string.
      options - The replace options.
      Returns:
      Number of cells that was replaced.
      
       worksheet.getRange("A1:A2").setValue(new Object[][] {{"North"}, {"north"}});
       ReplaceOptions options = new ReplaceOptions();
       options.setMatchCase(true);
       int replacedCount = worksheet.getRange("A1:A2").replace("North", "East", options);
       
    • autoFit

      void autoFit()
      Changes the width of the columns in the range or the height of the rows in the range to achieve the best fit.
      
       IRange range = worksheet.getRange("A:A");
       worksheet.getRange("A1").setValue("Long text for autofit");
       range.autoFit();
       double width = range.getColumnWidth();
       
    • autoFit

      void autoFit(boolean considerMergedCell)
      Changes the width of the columns in the range or the height of the rows in the range to achieve the best fit.
      Parameters:
      considerMergedCell - Indicates whether to consider merged cells in a single row.
      
       IRange range = worksheet.getRange("A1:B1");
       range.merge();
       range.setValue("Long merged text for autofit");
       range.autoFit(true);
       double height = range.getRowHeight();
       
    • subtotal

      void subtotal(int groupBy, ConsolidationFunction subtotalFunction, int[] totalList)
      Creates subtotals for the range.
      Parameters:
      groupBy - The field to group by, as a one-based integer offset.
      subtotalFunction - The subtotal function.
      totalList - An array of 1-based field offsets, indicating the fields to which the subtotals are added.
      
       worksheet.getRange("A1:B4").setValue(new Object[][] {{"Region", "Amount"}, {"East", 120}, {"East", 80}, {"West", 90}});
       worksheet.getRange("A1:B4").subtotal(1, ConsolidationFunction.Sum, new int[] {2});
       Object subtotalLabel = worksheet.getRange("A4").getValue();
       
    • subtotal

      void subtotal(int groupBy, ConsolidationFunction subtotalFunction, int[] totalList, boolean replace)
      Creates subtotals for the range.
      Parameters:
      groupBy - The field to group by, as a one-based integer offset.
      subtotalFunction - The subtotal function.
      totalList - An array of 1-based field offsets, indicating the fields to which the subtotals are added.
      replace - True to replace existing subtotals. The default value is True.
      
       worksheet.getRange("A1:B4").setValue(new Object[][] {{"Region", "Amount"}, {"East", 120}, {"East", 80}, {"West", 90}});
       worksheet.getRange("A1:B4").subtotal(1, ConsolidationFunction.Sum, new int[] {2}, true);
       Object subtotalLabel = worksheet.getRange("A4").getValue();
       
    • subtotal

      void subtotal(int groupBy, ConsolidationFunction subtotalFunction, int[] totalList, boolean replace, boolean pageBreaks)
      Creates subtotals for the range.
      Parameters:
      groupBy - The field to group by, as a one-based integer offset.
      subtotalFunction - The subtotal function.
      totalList - An array of 1-based field offsets, indicating the fields to which the subtotals are added.
      replace - True to replace existing subtotals. The default value is True.
      pageBreaks - True to add page breaks after each group. The default value is False.
      
       worksheet.getRange("A1:B4").setValue(new Object[][] {{"Region", "Amount"}, {"East", 120}, {"East", 80}, {"West", 90}});
       worksheet.getRange("A1:B4").subtotal(1, ConsolidationFunction.Sum, new int[] {2}, true, false);
       Object subtotalLabel = worksheet.getRange("A4").getValue();
       
    • subtotal

      void subtotal(int groupBy, ConsolidationFunction subtotalFunction, int[] totalList, SummaryRow summaryRowLocation)
      Creates subtotals for the range.
      Parameters:
      groupBy - The field to group by, as a one-based integer offset.
      subtotalFunction - The subtotal function.
      totalList - An array of 1-based field offsets, indicating the fields to which the subtotals are added.
      summaryRowLocation - Places the summary data relative to the subtotal. The default value is Below.
      
       worksheet.getRange("A1:B4").setValue(new Object[][] {{"Region", "Amount"}, {"East", 120}, {"East", 80}, {"West", 90}});
       worksheet.getRange("A1:B4").subtotal(1, ConsolidationFunction.Sum, new int[] {2}, SummaryRow.Below);
       Object subtotalLabel = worksheet.getRange("A4").getValue();
       
    • subtotal

      void subtotal(int groupBy, ConsolidationFunction subtotalFunction, int[] totalList, boolean replace, boolean pageBreaks, SummaryRow summaryRowLocation)
      Creates subtotals for the range.
      Parameters:
      groupBy - The field to group by, as a one-based integer offset.
      subtotalFunction - The subtotal function.
      totalList - An array of 1-based field offsets, indicating the fields to which the subtotals are added.
      replace - True to replace existing subtotals. The default value is True.
      pageBreaks - True to add page breaks after each group. The default value is False.
      summaryRowLocation - Places the summary data relative to the subtotal. The default value is Below.
      
       worksheet.getRange("A1:B4").setValue(new Object[][] {{"Region", "Amount"}, {"East", 120}, {"East", 80}, {"West", 90}});
       worksheet.getRange("A1:B4").subtotal(1, ConsolidationFunction.Sum, new int[] {2}, true, false, SummaryRow.Below);
       Object subtotalLabel = worksheet.getRange("A4").getValue();
       
    • removeSubtotal

      void removeSubtotal()
      Removes subtotals from a list.
      
       worksheet.getRange("A1:B4").setValue(new Object[][] {{"Region", "Amount"}, {"East", 120}, {"East", 80}, {"West", 90}});
       IRange range = worksheet.getRange("A1:B4");
       range.subtotal(1, ConsolidationFunction.Sum, new int[] {2});
       range.removeSubtotal();
       Object value = worksheet.getRange("A4").getValue();
       
    • getPrecedents

      List<IRange> getPrecedents()
      Gets the precedent ranges of the left top cell of the range.
      
       worksheet.getRange("A1").setValue(10);
       worksheet.getRange("B1").setFormula("=A1*2");
       List<IRange> precedents = worksheet.getRange("B1").getPrecedents();
       
      Returns:
      The precedent ranges of the left top cell of the range.
    • getPrecedents

      List<IRange> getPrecedents(boolean includeInDirect)
      Gets the precedent ranges of all the cells of the range.
      Parameters:
      includeInDirect - Indicates whether to include indirect precedents.
      Returns:
      The precedent ranges of all the cells of the range.
      
       worksheet.getRange("A1").setValue(10);
       worksheet.getRange("B1").setFormula("=A1*2");
       List<IRange> precedents = worksheet.getRange("B1").getPrecedents(true);
       
    • getDependents

      List<IRange> getDependents()
      Gets the dependent ranges of the left top cell of the range.
      
       worksheet.getRange("A1").setValue(10);
       worksheet.getRange("B1").setFormula("=A1*2");
       List<IRange> dependents = worksheet.getRange("A1").getDependents();
       
      Returns:
      The dependent ranges of the left top cell of the range.
    • getDependents

      List<IRange> getDependents(boolean includeIndirect)
      Gets the dependent ranges of all the cells of the range.
      Parameters:
      includeIndirect - Include the indirect dependent cells.
      Returns:
      The dependent ranges of all the cells of the range.
      
       worksheet.getRange("A1").setValue(10);
       worksheet.getRange("B1").setFormula("=A1*2");
       List<IRange> dependents = worksheet.getRange("A1").getDependents(true);
       
    • toImage

      void toImage(String imageFile)
      Saves the range to the specified image file.
      Parameters:
      imageFile - The output image file.
      
       worksheet.getRange("A1").setValue("Exported");
       worksheet.getRange("A1:B2").toImage("path/to/range.png");
       
    • toImage

      void toImage(String imageFile, ImageSaveOptions options)
      Saves the range to the specified image file using options.
      Parameters:
      imageFile - The output image file.
      options - The options for output image.
      
       worksheet.getRange("A1").setValue("Exported");
       ImageSaveOptions options = new ImageSaveOptions();
       options.setShowGridlines(true);
       worksheet.getRange("A1:B2").toImage("path/to/range.png", options);
       
    • toImage

      void toImage(OutputStream stream, ImageType imageType)
      Saves the range to the specified image stream.
      Parameters:
      stream - The output image stream.
      imageType - Specifies the type of image to create.
      
       worksheet.getRange("A1").setValue("Exported");
       ByteArrayOutputStream stream = new ByteArrayOutputStream();
       worksheet.getRange("A1:B2").toImage(stream, ImageType.PNG);
       byte[] imageBytes = stream.toByteArray();
       
    • toImage

      void toImage(OutputStream stream, ImageType imageType, ImageSaveOptions options)
      Saves the range to the specified image stream using options.
      Parameters:
      stream - The output image stream.
      imageType - Specifies the type of image to create.
      options - The options for output image.
      
       worksheet.getRange("A1").setValue("Exported");
       ImageSaveOptions options = new ImageSaveOptions();
       options.setShowGridlines(true);
       ByteArrayOutputStream stream = new ByteArrayOutputStream();
       worksheet.getRange("A1:B2").toImage(stream, ImageType.PNG, options);
       byte[] imageBytes = stream.toByteArray();
       
    • getAddress

      String getAddress()
      Returns a String value that represents the range reference.
      
       IRange range = worksheet.getRange("B2:C3");
       String address = range.getAddress();
       
      Returns:
      A String value that represents the range reference.
    • getAddress

      String getAddress(boolean rowAbsolute, boolean columnAbsolute)
      Returns a String value that represents the range reference.
      
       IRange range = worksheet.getRange("B2:C3");
       String address = range.getAddress(false, false);
       
      Parameters:
      rowAbsolute - True to return the row part of the reference as an absolute reference. The default value is true.
      columnAbsolute - True to return the column part of the reference as an absolute reference. The default value is true.
      Returns:
      A String value that represents the range reference.
    • getAddress

      String getAddress(boolean rowAbsolute, boolean columnAbsolute, ReferenceStyle referenceStyle)
      Returns a String value that represents the range reference.
      
       IRange range = worksheet.getRange("B2:C3");
       String address = range.getAddress(false, false, ReferenceStyle.R1C1);
       
      Parameters:
      rowAbsolute - True to return the row part of the reference as an absolute reference. The default value is true.
      columnAbsolute - True to return the column part of the reference as an absolute reference. The default value is true.
      referenceStyle - The reference style. The default value is A1.
      Returns:
      A String value that represents the range reference.
    • getAddress

      String getAddress(boolean rowAbsolute, boolean columnAbsolute, ReferenceStyle referenceStyle, IRange relativeTo)
      Returns a String value that represents the range reference.
      
       IRange range = worksheet.getRange("B2:C3");
       String address = range.getAddress(false, false, ReferenceStyle.R1C1, worksheet.getRange("A1"));
       
      Parameters:
      rowAbsolute - True to return the row part of the reference as an absolute reference. The default value is true.
      columnAbsolute - True to return the column part of the reference as an absolute reference. The default value is true.
      referenceStyle - The reference style. The default value is A1.
      relativeTo - If RowAbsolute and ColumnAbsolute are false, and ReferenceStyle is R1C1, defines a starting point for the relative reference. The default reference is $A$1.
      Returns:
      A String value that represents the range reference.
    • specialCells

      IRange specialCells(SpecialCellType type)
      Gets a IRange object that represents all the cells that match the specified type and value.
      
       worksheet.getRange("A1").setValue("Header");
       worksheet.getRange("A3").setValue("Total");
       IRange blanks = worksheet.getRange("A1:A3").specialCells(SpecialCellType.Blanks);
       String address = blanks.getAddress();
       
      Parameters:
      type - The type of cells to include.
      Returns:
      A IRange object that represents all the cells that match the specified type and value.
    • specialCells

      IRange specialCells(SpecialCellType type, SpecialCellsValue value)
      Gets a IRange object that represents all the cells that match the specified type and value.
      
       worksheet.getRange("A1").setValue("Text");
       worksheet.getRange("A2").setValue(100);
       IRange numbers = worksheet.getRange("A1:A2").specialCells(SpecialCellType.Constants, SpecialCellsValue.Numbers);
       String address = numbers.getAddress();
       
      Parameters:
      type - The type of cells to include.
      value - The value type to include when type is SpecialCellType.Constants or SpecialCellType.Formulas.
      Returns:
      A IRange object that represents all the cells that match the specified type and value.
    • getCellPadding

      ICellPadding getCellPadding()
      Gets the cell padding for range.
      Returns:
      An ICellPadding object SpreadJS only.
      
       IRange range = worksheet.getRange("A1");
       range.setCellPadding(new CellPadding(10, 20, 10, 5));
       ICellPadding padding = range.getCellPadding();
       double left = padding.getLeft();
       
    • setCellPadding

      void setCellPadding(ICellPadding cellPadding)
      Sets the cell padding for range.
      Parameters:
      cellPadding - SpreadJS only.
      
       IRange range = worksheet.getRange("A1");
       range.setCellPadding(new CellPadding(10, 20, 10, 5));
       ICellPadding padding = range.getCellPadding();
       
    • getWatermark

      String getWatermark()
      Gets the watermark for range. SpreadJS only.
      Returns:
      the watermark string
      
       IRange range = worksheet.getRange("A1");
       range.setWatermark("Required");
       String watermark = range.getWatermark();
       
    • setWatermark

      void setWatermark(String watermark)
      Sets the watermark for range. SpreadJS only.
      Parameters:
      watermark - The watermark string
      
       IRange range = worksheet.getRange("A1");
       range.setWatermark("Required");
       String watermark = range.getWatermark();
       
    • getDecoration

      ICellDecoration getDecoration()
      Gets the cell decoration for range. SpreadJS only.
      Returns:
      The cell decoration.
      
       ICornerFold cornerFold = new CornerFold(Color.GetRed(), EnumSet.of(CornerPosition.LeftTop), 8);
       IRange range = worksheet.getRange("A1");
       range.setDecoration(new CellDecoration(cornerFold));
       ICellDecoration decoration = range.getDecoration();
       
    • setDecoration

      void setDecoration(ICellDecoration value)
      Sets the cell decoration for range. SpreadJS only.
      Parameters:
      value - The cell decoration.
      
       ICornerFold cornerFold = new CornerFold(Color.GetRed(), EnumSet.of(CornerPosition.LeftTop), 8);
       IRange range = worksheet.getRange("A1");
       range.setDecoration(new CellDecoration(cornerFold));
       ICellDecoration decoration = range.getDecoration();
       
    • getLabelOptions

      ILabelOptions getLabelOptions()
      Gets the display options for the watermark label. SpreadJS only.
      Returns:
      The ILabelOptions object that controls the watermark label display options.
      
       IRange range = worksheet.getRange("A1");
       range.setWatermark("Required");
       ILabelOptions labelOptions = range.getLabelOptions();
       labelOptions.setVisibility(LabelVisibility.visible);
       
    • fromJson

      void fromJson(String json)
      Generates the range data from the json string.
      Parameters:
      json - the json string that contains range info.
      
       worksheet.getRange("A1").setValue("Original");
       String json = worksheet.getRange("A1").toJson();
       worksheet.getRange("B1").fromJson(json);
       Object value = worksheet.getRange("B1").getValue();
       
    • toJson

      String toJson()
      Generates a json string from the range.
      Returns:
      the json string that contains range info.
      
       worksheet.getRange("A1").setValue("Serialized");
       String json = worksheet.getRange("A1").toJson();
       
    • addCommentThreaded

      ICommentThreaded addCommentThreaded(String text)
      Adds a threaded comment to the range.
      Parameters:
      text - The string is content of the threaded comment.
      Returns:
      The added ICommentThreaded object; see ICommentThreaded.
      
       IRange range = worksheet.getRange("A1");
       ICommentThreaded comment = range.addCommentThreaded("Review this value.");
       String text = comment.getText();
       
    • addCommentThreaded

      ICommentThreaded addCommentThreaded(String text, String author)
      Adds a threaded comment to the range.
      Parameters:
      text - The string is content of the threaded comment.
      author - Author name of the threaded comment.
      Returns:
      The newly added threaded comment.
      
       IRange range = worksheet.getRange("A1");
       ICommentThreaded comment = range.addCommentThreaded("Review this value.", "Alex");
       String author = comment.getAuthor().getName();
       
    • getCommentThreaded

      ICommentThreaded getCommentThreaded()
      Gets the threaded comment of the specified cell.
      
       IRange range = worksheet.getRange("A1");
       range.addCommentThreaded("Review this value.", "Alex");
       ICommentThreaded comment = range.getCommentThreaded();
       String text = comment.getText();
       
      Returns:
      The threaded comment of the specified cell.
    • generateGetPivotDataFunction

      String generateGetPivotDataFunction(IRange destination)
      Generate the corresponding function "GETPIVOTDATA" for the cells in the pivot table.
      Parameters:
      destination - Indicates for which area the "GETPIVOTDATA" function is generated.
      Returns:
      "GETPIVOTDATA" function
      
       worksheet.getRange("A1:B3").setValue(new Object[][] {{"Region", "Amount"}, {"East", 120}, {"West", 90}});
       IPivotCache cache = workbook.getPivotCaches().create(worksheet.getRange("A1:B3"));
       IPivotTable pivotTable = worksheet.getPivotTables().add(cache, worksheet.getRange("D1"), "SalesPivot");
       pivotTable.getPivotFields().get("Region").setOrientation(PivotFieldOrientation.RowField);
       pivotTable.addDataField(pivotTable.getPivotFields().get("Amount"), "Sum of Amount", ConsolidationFunction.Sum);
       IRange valueCell = pivotTable.getDataBodyRange().get(0);
       String formula = valueCell.generateGetPivotDataFunction(worksheet.getRange("G1"));
       
    • generateGetPivotDataFunction

      String generateGetPivotDataFunction()
      Generate the corresponding function "GETPIVOTDATA" for the cells in the pivot table.
      Returns:
      "GETPIVOTDATA" function
      
       worksheet.getRange("A1:B3").setValue(new Object[][] {{"Region", "Amount"}, {"East", 120}, {"West", 90}});
       IPivotCache cache = workbook.getPivotCaches().create(worksheet.getRange("A1:B3"));
       IPivotTable pivotTable = worksheet.getPivotTables().add(cache, worksheet.getRange("D1"), "SalesPivot");
       pivotTable.getPivotFields().get("Region").setOrientation(PivotFieldOrientation.RowField);
       pivotTable.addDataField(pivotTable.getPivotFields().get("Amount"), "Sum of Amount", ConsolidationFunction.Sum);
       IRange valueCell = pivotTable.getDataBodyRange().get(0);
       String formula = valueCell.generateGetPivotDataFunction();
       
    • intersect

      IRange intersect(IRange range2)
      Returns an IRange object that represents the intersection of two ranges.
      If range2 is from a different worksheet, an exception is thrown.
      Parameters:
      range2 - The range to intersect with this range.
      Returns:
      A new range which consists of the intersection of this range and range2, or null if the ranges do not intersect.
      
       IRange first = worksheet.getRange("A1:C3");
       IRange second = worksheet.getRange("B2:D4");
       IRange intersection = first.intersect(second);
       String address = intersection.getAddress();
       
    • intersect

      IRange intersect(IRange... ranges)
      Returns an IRange object that represents the intersection of several ranges.
      If one or more ranges from a different worksheet are specified, an exception is thrown.
      Parameters:
      ranges - The intersecting ranges.
      Returns:
      A new range which consists of the intersection of this range and other ranges, or null if the ranges do not intersect.
      
       IRange baseRange = worksheet.getRange("A1:D4");
       IRange intersection = baseRange.intersect(worksheet.getRange("B2:D4"), worksheet.getRange("B2:C3"));
       String address = intersection.getAddress();
       
    • union

      IRange union(IRange range2)
      Returns an IRange object that represents the union of two ranges.
      If range2 is from a different worksheet, an exception is thrown.
      Parameters:
      range2 - The range to union with this range.
      Returns:
      A new range which consists of the union of this range and range2.
      
       IRange first = worksheet.getRange("A1:A2");
       IRange second = worksheet.getRange("C1:C2");
       IRange union = first.union(second);
       int areaCount = union.getAreas().getAreaCount();
       
    • union

      IRange union(IRange... ranges)
      Returns an IRange object that represents the union of several ranges.
      If one or more ranges from a different worksheet are specified, an exception is thrown.
      Parameters:
      ranges - Other ranges to union with this range.
      Returns:
      A new range which consists of the union of this range and other ranges.
      
       IRange union = worksheet.getRange("A1").union(worksheet.getRange("C1"), worksheet.getRange("E1"));
       int areaCount = union.getAreas().getAreaCount();
       
    • offset

      IRange offset(int rowOffset, int columnOffset)
      Returns an IRange object that represents the offset of this range.
      Parameters:
      rowOffset - Row offset.
      columnOffset - Column offset.
      Returns:
      A new range which consists of the offset of this range.
      
       IRange range = worksheet.getRange("A1");
       IRange offsetRange = range.offset(1, 1);
       offsetRange.setValue("B2");
       Object value = worksheet.getRange("B2").getValue();
       
    • getDefaultValue

      Object getDefaultValue()
      Gets the default value of the cell, it can be the value data or the formula string. It works when the cell has no data.
      
       IRange range = worksheet.getRange("A1");
       range.setDefaultValue("Not entered");
       Object defaultValue = range.getDefaultValue();
       
      Returns:
      The default value of the cell, it can be the value data or the formula string.
    • setDefaultValue

      void setDefaultValue(Object value)
      Sets the default value of the cell, it can be the value data or the formula string. It works when the cell has no data.
      
       IRange range = worksheet.getRange("A1");
       range.setDefaultValue("Not entered");
       Object value = range.getValue();
       
      Parameters:
      value - The default value of the cell, it can be the value data or the formula string. It works when the cell has no data.
    • goalSeek

      boolean goalSeek(double goal, IRange changingCell)
      Attempts to achieve the specified goal, from the calculated result of the formula in the cell represented by this IRange, by modifying the specified changingCell. If you know the result that you want from a formula, but are not sure what input value the formula needs to get that result, use the Goal Seek feature.
      Parameters:
      goal - Specifies the desired goal value.
      changingCell - Specifies the cell to change.
      Returns:
      True if the specified goal value is successfully found, otherwise False.
      
       worksheet.getRange("A1").setValue(10);
       worksheet.getRange("B1").setFormula("=A1*2");
       boolean solved = worksheet.getRange("B1").goalSeek(50, worksheet.getRange("A1"));
       Object input = worksheet.getRange("A1").getValue();
       
    • getBackgroundImage

      byte[] getBackgroundImage()
      Gets the cell background image.
      Returns:
      Cell background image byte array.
      
       byte[] imageBytes = new byte[] {
           (byte) 0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A,
           0x00, 0x00, 0x00, 0x0D, 0x49, 0x48, 0x44, 0x52,
           0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01,
           0x08, 0x06, 0x00, 0x00, 0x00, 0x1F, 0x15, (byte) 0xC4,
           (byte) 0x89, 0x00, 0x00, 0x00, 0x0A, 0x49, 0x44, 0x41,
           0x54, 0x78, (byte) 0x9C, 0x63, 0x00, 0x01, 0x00, 0x00,
           0x05, 0x00, 0x01, 0x0D, 0x0A, 0x2D, (byte) 0xB4,
           0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4E, 0x44,
           (byte) 0xAE, 0x42, 0x60, (byte) 0x82
       };
       IRange range = worksheet.getRange("A1");
       range.setBackgroundImage(imageBytes);
       byte[] backgroundImage = range.getBackgroundImage();
       
    • setBackgroundImage

      void setBackgroundImage(byte[] backgroundImage)
      Sets the cell background image. Supported image types include: PNG, JPG, ICO, SVG, GIF. This would be visible only in SpreadJS and Exporting to PDF/HTML/IMG.
      Parameters:
      backgroundImage - Cell background image byte array.
      
       byte[] imageBytes = new byte[] {
           (byte) 0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A,
           0x00, 0x00, 0x00, 0x0D, 0x49, 0x48, 0x44, 0x52,
           0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01,
           0x08, 0x06, 0x00, 0x00, 0x00, 0x1F, 0x15, (byte) 0xC4,
           (byte) 0x89, 0x00, 0x00, 0x00, 0x0A, 0x49, 0x44, 0x41,
           0x54, 0x78, (byte) 0x9C, 0x63, 0x00, 0x01, 0x00, 0x00,
           0x05, 0x00, 0x01, 0x0D, 0x0A, 0x2D, (byte) 0xB4,
           0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4E, 0x44,
           (byte) 0xAE, 0x42, 0x60, (byte) 0x82
       };
       IRange range = worksheet.getRange("A1");
       range.setBackgroundImage(imageBytes);
       byte[] backgroundImage = range.getBackgroundImage();
       
    • getBackgroundImageLayout

      BackgroundImageLayout getBackgroundImageLayout()
      Gets the cell background image layout, default is Stretch.
      Returns:
      Background image layout of cell.
      
       IRange range = worksheet.getRange("A1");
       range.setBackgroundImageLayout(BackgroundImageLayout.Center);
       BackgroundImageLayout layout = range.getBackgroundImageLayout();
       
    • setBackgroundImageLayout

      void setBackgroundImageLayout(BackgroundImageLayout backgroundImageLayout)
      Sets the cell background image layout.
      Parameters:
      backgroundImageLayout - Background image layout of cell.
      
       IRange range = worksheet.getRange("A1");
       range.setBackgroundImageLayout(BackgroundImageLayout.Center);
       BackgroundImageLayout layout = range.getBackgroundImageLayout();
       
    • importData

      DataImportResult importData(Object items)
      Imports data from a data source (up to 2D) to the range.
      
       Map<String, Object> item = new LinkedHashMap<>();
       item.put("Name", "Alice");
       item.put("Score", 95);
       DataImportResult result = worksheet.getRange("A1").importData(new Map[] {item});
       int rowsImported = result.getRowsImported();
       
      Parameters:
      items - The items to import. The element type can be: The collection type can be:
      • Flat (non-jagged, 1D in total) Iterable or array.
      • Jagged 2D array where the element type of the inner collection is primitive or nullable primitive.
      Returns:
      The result.
      Throws:
      ClassCastException - The data type of column is inconsistent. Use DataImportOptions.setItemTypeProvider(java.util.function.Function<java.lang.Object, java.lang.Class<?>>) to fix it.
      IllegalArgumentException - An item is of an unsupported type or options contains incorrect information.
      API Note:
      If the items are a list or array of primitive types, the orientation is determined by the shape of the range. If the row count of the range is greater than column count, we import the collection vertically. Otherwise, we import the collection horizontally.
    • importData

      DataImportResult importData(Object items, DataImportOptions options)
      Imports data from a data source (up to 2D) to the range.
      
       Map<String, Object> item = new LinkedHashMap<>();
       item.put("Name", "Alice");
       item.put("Score", 95);
       DataImportOptions options = new DataImportOptions();
       options.setColumnsSelector(source -> new String[] {"Name"});
       DataImportResult result = worksheet.getRange("A1").importData(new Map[] {item}, options);
       int columnsImported = result.getColumnsImported();
       
      Parameters:
      items - The items to import. The element type can be: The collection type can be:
      • Flat (non-jagged, 1D in total) Iterable or array.
      • Jagged 2D array where the element type of the inner collection is primitive or nullable primitive.
      options - The import options.
      Returns:
      The result.
      Throws:
      ClassCastException - The data type of column is inconsistent. Use DataImportOptions.setItemTypeProvider(java.util.function.Function<java.lang.Object, java.lang.Class<?>>) to fix it.
      IllegalArgumentException - An item is of an unsupported type or options contains incorrect information.
      API Note:
      If the items are a list or array of primitive types, the orientation is determined by the shape of the range. If the row count of the range is greater than column count, we import the collection vertically. Otherwise, we import the collection horizontally.
    • getCellPicture

      CellPicture getCellPicture()
      Gets the picture-in-cell of the specified cell. Returns null if the cell does not contain a picture-in-cell. When the range contains multiple cells, only the top-left cell is read.

      This method also supports reading valid pictures generated by the IMAGE() function.

      The returned CellPicture object is a copy of the picture data. Modifying the returned object does not affect the picture stored in the cell. To apply changes, the modified CellPicture must be set back using setCellPicture(CellPicture).

      Returns:
      The CellPicture object, or null.
      
       CellPicture picture = new CellPicture(new byte[] {
           (byte) 0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A,
           0x00, 0x00, 0x00, 0x0D, 0x49, 0x48, 0x44, 0x52,
           0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01,
           0x08, 0x06, 0x00, 0x00, 0x00, 0x1F, 0x15, (byte) 0xC4,
           (byte) 0x89, 0x00, 0x00, 0x00, 0x0A, 0x49, 0x44, 0x41,
           0x54, 0x78, (byte) 0x9C, 0x63, 0x00, 0x01, 0x00, 0x00,
           0x05, 0x00, 0x01, 0x0D, 0x0A, 0x2D, (byte) 0xB4,
           0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4E, 0x44,
           (byte) 0xAE, 0x42, 0x60, (byte) 0x82
       }, "Logo");
       IRange range = worksheet.getRange("A1");
       range.setCellPicture(picture);
       CellPicture cellPicture = range.getCellPicture();
       
    • setCellPicture

      void setCellPicture(CellPicture picture)
      Sets a picture-in-cell for the specified cell. Pass null to remove the picture. When the range contains multiple cells, the picture is applied to each cell.
      Parameters:
      picture - The CellPicture object, or null to remove.
      
       CellPicture picture = new CellPicture(new byte[] {
           (byte) 0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A,
           0x00, 0x00, 0x00, 0x0D, 0x49, 0x48, 0x44, 0x52,
           0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01,
           0x08, 0x06, 0x00, 0x00, 0x00, 0x1F, 0x15, (byte) 0xC4,
           (byte) 0x89, 0x00, 0x00, 0x00, 0x0A, 0x49, 0x44, 0x41,
           0x54, 0x78, (byte) 0x9C, 0x63, 0x00, 0x01, 0x00, 0x00,
           0x05, 0x00, 0x01, 0x0D, 0x0A, 0x2D, (byte) 0xB4,
           0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4E, 0x44,
           (byte) 0xAE, 0x42, 0x60, (byte) 0x82
       }, "Logo");
       IRange range = worksheet.getRange("A1");
       range.setCellPicture(picture);
       String altText = range.getCellPicture().getAltText();