Example: Range

import com.ibm.symphony.javaapi.Application;
import com.ibm.symphony.javaapi.Constant;
import com.ibm.symphony.javaapi.Font;
import com.ibm.symphony.javaapi.spreadsheet.Range;
import com.ibm.symphony.javaapi.spreadsheet.Sheet;
import com.ibm.symphony.javaapi.spreadsheet.Spreadsheet;

public class RangeExample {
	public void example() {
		try {
			Application application = Application.getInstance();
			Spreadsheet spreadsheet = application.getSpreadsheets()
					.openSpreadsheet("D:\test.ods", true);
			Sheet sheet = spreadsheet.getActiveSheet();
			Range range = sheet.range("A1:E6");
			int backColor = range.getBackgroundColor();
			// returns the number of rows in this range
			int row = range.getRow();
			int rowHeight = range.getRowHeight();
			// returns the number of columns in this range
			int column = range.getColumn();
			// returns the column width;
			int columnWidth = range.getColumnWidth();
			// return the number of cells in this range
			int count = range.getCount();
			// return the entire column of the sheet while rows among this range
			Range entireColumn = range.getEntireColumn();
			// return the entire row of the sheet while columns among this range
			Range entireRow = range.getEntireRow();
			// returns the font of the range
			Font font = range.getFont();
			// Returns the height the range.
			int height = range.getHeight();
			// Returns the width of the range.
			int wid = range.getWidth();
			// True if the range contains merged cells.
			boolean mergeCells = range.isMergeCell();
			int wrapText = range.getWrapText();
			// return the formula of the range
			Range formulaRange = sheet.range("F4");
			String formula = formulaRange.getFormula();
			formulaRange.setFormula("=B7+C7");
			// returns whether the range has formula
			int hasFormula = formulaRange.hasFormula();
			// Returns or sets the text for the specified object.
			String text = formulaRange.getText();
			// Returns or sets a double value that represents the value of the
			// specified range.
			double value = formulaRange.getValue();
			Range rows = range.rows(2);
			Range columns = range.columns(2);
			range.group(Constant.SYMPHONY_ORIENTATION_COLUMN);
			Range offsetRange = range.offset(-1, 1);
			Range cell1 = range.cells(1, 1);
			Range cell2 = range.cells(3, 3);
			Range subRange = range.range(cell1, cell2);
			Range resizeRange = range.resize(6, 6);
		} catch (Exception e) {
			e.printStackTrace();
		}

	}

}

Related information

Range