[]
        
(Showing Draft Content)

ITableRow

Interface ITableRow


public interface ITableRow
Represents a row in an ITable.

An ITableRow object is a member of the ITableRows collection and corresponds to a single data row in a table. You can use it to access the row index, obtain the row range, or delete the row from the table.


 worksheet.getRange("A1:B3").setValue(new Object[][] {{"Name", "Value"}, {"A", 1}, {"B", 2}});
 ITable table = worksheet.getTables().add(worksheet.getRange("A1:B3"), true);
 ITableRow tableRow = table.getRows().get(0);
 IRange range = tableRow.getRange();
 
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Deletes the cells in this table row and shifts the cells below the deleted row upward.
    int
    Gets the index of this ITableRow within the ITableRows collection.
    Gets the IRange object that represents the range occupied by this table row.
  • Method Details

    • getIndex

      int getIndex()
      Gets the index of this ITableRow within the ITableRows collection.

      Use this method to determine the position of a data row in the table's row collection.

      
       worksheet.getRange("A1:B3").setValue(new Object[][] {
           {"Name", "Value"},
           {"A", 100},
           {"B", 200}
       });
       ITable table = worksheet.getTables().add(worksheet.getRange("A1:B3"), true);
       ITableRow row = table.getRows().get(1);
       int index = row.getIndex();
       
      Returns:
      The index of this ITableRow within the ITableRows collection.
    • getRange

      IRange getRange()
      Gets the IRange object that represents the range occupied by this table row.

      The returned range corresponds to the cells occupied by the current data row within its parent ITable.

      
       worksheet.getRange("A1:B3").setValue(new Object[][] {
           {"Name", "Value"},
           {"Test", 100},
           {"Demo", 200}
       });
       ITable table = worksheet.getTables().add(worksheet.getRange("A1:B3"), true);
       ITableRow row = table.getRows().get(0);
       IRange range = row.getRange();
       
      Returns:
      The IRange object that represents the range occupied by this table row.
    • delete

      void delete()
      Deletes the cells in this table row and shifts the cells below the deleted row upward.

      Use this method to remove a data row from a ITable. The deleted row is removed from the table's data rows, and the remaining cells below it are shifted up.

      
       worksheet.getRange("A1:B3").setValue(new Object[][] {
           {"Name", "Value"},
           {"Apple", 100},
           {"Orange", 200}
       });
       ITable table = worksheet.getTables().add(worksheet.getRange("A1:B3"), true);
       ITableRow row = table.getRows().get(0);
       row.delete();