}
}
public void exportToPDF(JSONObject worksheetJSON, OutputStream outputStream) throws Exception {
WorkSheetPDFExporter exporter = new WorkSheetPDFExporter();
exporter.open(outputStream);
exporter.setNumberFormat(numberFormat);
exporter.setUserDateFormat(userDateFormat);
int sheetsNumber = worksheetJSON.getInt(SHEETS_NUM);
JSONArray exportedSheets = worksheetJSON.getJSONArray(EXPORTED_SHEETS);
for (int i = 0; i < sheetsNumber; i++) {
JSONObject sheetJ = exportedSheets.getJSONObject(i);
if(isTableContent(sheetJ)){
IDataStore dataStore = getTableDataStore(sheetJ);
exporter.addSheet(sheetJ, dataStore);
}else{
exporter.addSheet(sheetJ);
}
}
exporter.close();
outputStream.flush();
}