This example creates a DataPilot table first, and then adds fields for it.
try { Application application = Application.getInstance(); Spreadsheet spreadsheet = application.getSpreadsheets().openSpreadsheet("F:\\DataPilot.ods", true); Sheet sheet = spreadsheet.getActiveSheet(); Range sourcerange = sheet.range("A2:E8"); Range destRange = sheet.cells(13, 6); DataPilotTable dataPilotTable = sheet.getDataPilotTables().add(sourcerange, "Sells report", destRange); String[] rowfieldsarray = {"Item"}; String[] colfieldsarray = {"Requested by"}; String[] datafieldsarray = {"total price"}; String[] pagefieldsarray = {"P.O.#"}; dataPilotTable.addFields(rowfieldsarray, colfieldsarray, datafieldsarray,pagefieldsarray, Constant.SYMPHONY_GENERAL_FUNCTION_SUM); } catch(Exception e) { e.printStackTrace(); }
Related information