Example: Font

This example sets font for a range of a spreadsheet.

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;
import com.ibm.symphony.javaapi.spreadsheet.Spreadsheets;

public class FontExample {

	public void example() {
		try {
			Application application = Application.getInstance();
			Spreadsheets spreadsheets = application.getSpreadsheets();
			Spreadsheet spreadsheet = spreadsheets.openSpreadsheet(
					"D:\\test.ods", true);
			Sheet sheet = spreadsheet.getActiveSheet();
			Range range = sheet.range("A1:E5");
			Font font = range.getFont();
			font.setName("Times New Roman");
			font.setColor(application.RGB(123, 123, 123));
			font.setHeight(16);
			font.setWeight(200);
			font.setStrikethrough(true);
			font.setUnderline(Constant.SYMPHONY_UNDERLINE_BOLDDASH);
		} catch (Exception e) {
			e.printStackTrace();
		}

	}

}

Related information

Font