/** * this method writes the data into sheet * * @param sheet * sheet of embedded excel * @param categoryData * category values * @param valuesData * data values * @since POI 4.0.0 */ protected void fillSheet(XSSFSheet sheet, XDDFDataSource<?> categoryData, XDDFNumericalDataSource<?> valuesData) { int numOfPoints = categoryData.getPointCount(); for (int i = 0; i < numOfPoints; i++) { XSSFRow row = this.getRow(sheet, i + 1); // first row is for title this.getCell(row, categoryData.getColIndex()).setCellValue(categoryData.getPointAt(i).toString()); this.getCell(row, valuesData.getColIndex()).setCellValue(valuesData.getPointAt(i).doubleValue()); } }
/** * set sheet title in excel file * * @param title * title of sheet * @param column * column index * @return return cell reference * @since POI 4.0.0 */ public CellReference setSheetTitle(String title, int column) { XSSFSheet sheet = getSheet(); XSSFRow row = this.getRow(sheet, 0); XSSFCell cell = this.getCell(row, column); cell.setCellValue(title); this.updateSheetTable(sheet.getTables().get(0).getCTTable(), title, column); return new CellReference(sheet.getSheetName(), 0, column, true, true); }
/** * this method writes the data into sheet * * @param sheet * sheet of embedded excel * @param categoryData * category values * @param valuesData * data values * @since POI 4.0.0 */ protected void fillSheet(XSSFSheet sheet, XDDFDataSource<?> categoryData, XDDFNumericalDataSource<?> valuesData) { int numOfPoints = categoryData.getPointCount(); for (int i = 0; i < numOfPoints; i++) { XSSFRow row = this.getRow(sheet, i + 1); // first row is for title this.getCell(row, categoryData.getColIndex()).setCellValue(categoryData.getPointAt(i).toString()); this.getCell(row, valuesData.getColIndex()).setCellValue(valuesData.getPointAt(i).doubleValue()); } }
/** * set sheet title in excel file * * @param title * title of sheet * @param column * column index * @return return cell reference * @since POI 4.0.0 */ public CellReference setSheetTitle(String title, int column) { XSSFSheet sheet = getSheet(); XSSFRow row = this.getRow(sheet, 0); XSSFCell cell = this.getCell(row, column); cell.setCellValue(title); this.updateSheetTable(sheet.getTables().get(0).getCTTable(), title, column); return new CellReference(sheet.getSheetName(), 0, column, true, true); }