Example: Sheet

This example adds a sheet before the first sheet, and then copies the new sheet after the second sheet, at last moves it after the third sheet.

import com.ibm.symphony.javaapi.Application;
import com.ibm.symphony.javaapi.spreadsheet.Sheet;
import com.ibm.symphony.javaapi.spreadsheet.Sheets;
import com.ibm.symphony.javaapi.spreadsheet.Spreadsheet;
import com.ibm.symphony.javaapi.spreadsheet.Spreadsheets;

public class ExampleSheet {

	public void example() {
		try {
			Application application = Application.getInstance();
			Spreadsheets spreadsheets = application.getSpreadsheets();
			Spreadsheet spreadsheet = spreadsheets.openSpreadsheet(
					"D:\\test.ods", true);
			Sheets sheets = spreadsheet.getSheets();
			sheets.addTo(sheets.item(1), 1, true);
			Sheet sheet = sheets.item(1);
			sheet.copyTo(sheets.item(2), false);
			sheet.moveTo(sheets.item(3), false);
			System.out.print(sheets.getCount());
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

}

Related information

Sheet