This example adds a sheet into a spreadsheet and displays the name of active sheet and the count of sheets in the spreadsheet.
import com.ibm.symphony.javaapi.Application; import com.ibm.symphony.javaapi.spreadsheet.Sheets; import com.ibm.symphony.javaapi.spreadsheet.Spreadsheet; import com.ibm.symphony.javaapi.spreadsheet.Spreadsheets; public class SheetsExample { public void example() { try { Application application = Application.getInstance(); Spreadsheets spreadsheets = application.getSpreadsheets(); Spreadsheet spreadsheet = spreadsheets.openSpreadsheet( "D:\\test.ods", true); Sheets sheets = spreadsheet.getSheets(); System.out.println("Before Add! Active sheet name : " + spreadsheet.getActiveSheet().getName() + " , Sheet count: " + sheets.getCount()); sheets.addTo(spreadsheet.getActiveSheet(), 1, true); System.out.println("After Add! Active sheet name : " + spreadsheet.getActiveSheet().getName() + " , Sheet count: " + sheets.getCount()); } catch (Exception e) { e.printStackTrace(); } } }
Related information