Example: Spreadsheet

This example opens a spreadsheet, and then saves it as Microsoft Excel file and exports it to a PDF file and prints the spreadsheet, at last closes the spreadsheet.

import com.ibm.symphony.javaapi.Application;
import com.ibm.symphony.javaapi.Constant;
import com.ibm.symphony.javaapi.spreadsheet.Spreadsheet;

public class SpreadsheetExample {

	public void example() {
		try {
			Application application = Application.getInstance();
			Spreadsheet spreadsheet = application.getSpreadsheets()
					.openSpreadsheet("D:\\test.ods", true);
			spreadsheet.saveAsSpreadsheet("C:\\test.xls", Constant.SYMPHONY_FILE_FORMAT_XLS);
			spreadsheet.exportPDF("C:\\test.PDF");
			System.out.println(spreadsheet.getName());
			spreadsheet.closeSpreadsheet(false);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

}

Related information

Spreadsheet