/** * Get the default row height for the sheet (if the rows do not define their own height) in * twips (1/20 of a point) * * @return default row height */ @Override public short getDefaultRowHeight() { return (short)(getDefaultRowHeightInPoints() * TWIPS_PER_POINT); }
/** * Get the default row height for the sheet (if the rows do not define their own height) in * points. * * @return default row height in points */ @Override public float getDefaultRowHeightInPoints() { return _sh.getDefaultRowHeightInPoints(); }
/** * @param sheet * @param row * @return height in twips (1/20th of point) for row or default */ private static float getRowHeight(XSSFSheet sheet, int row) { XSSFRow r = sheet.getRow(row); return r == null ? sheet.getDefaultRowHeightInPoints() : r.getHeightInPoints(); }
/** * Returns row height measured in point size. If the height is not set, the default worksheet value is returned, * See {@link org.apache.poi.xssf.usermodel.XSSFSheet#getDefaultRowHeightInPoints()} * * @return row height measured in point size * @see org.apache.poi.xssf.usermodel.XSSFSheet#getDefaultRowHeightInPoints() */ @Override public float getHeightInPoints() { if (this._row.isSetHt()) { return (float) this._row.getHt(); } return _sheet.getDefaultRowHeightInPoints(); }
private void writeTimeslotHoursVertically(List<Timeslot> dayTimeslotList) { for (Timeslot timeslot : dayTimeslotList) { nextRow(); nextCell().setCellValue(TIME_FORMATTER.format(timeslot.getStartDateTime()) + "-" + TIME_FORMATTER.format(timeslot.getEndDateTime())); currentRow.setHeightInPoints(3 * currentSheet.getDefaultRowHeightInPoints()); } }
private void writePersonMeetingList(Person person, boolean required) { nextRow(); currentRow.setHeightInPoints(2 * currentSheet.getDefaultRowHeightInPoints()); nextHeaderCell(person.getFullName()); if (required) { nextHeaderCell("Required"); } else { currentSheet.addMergedRegion(new CellRangeAddress(currentRowNumber - 1, currentRowNumber, currentColumnNumber, currentColumnNumber)); nextHeaderCell("Preferred"); } List<Meeting> personMeetingList; if (required) { personMeetingList = solution.getAttendanceList().stream() .filter(attendance -> attendance.getPerson().equals(person) && attendance instanceof RequiredAttendance) .map(Attendance::getMeeting) .collect(toList()); } else { personMeetingList = solution.getAttendanceList().stream() .filter(attendance -> attendance.getPerson().equals(person) && attendance instanceof PreferredAttendance) .map(Attendance::getMeeting) .collect(toList()); } List<MeetingAssignment> personMeetingAssignmentList = solution.getMeetingAssignmentList().stream() .filter(meetingAssignment -> personMeetingList.contains(meetingAssignment.getMeeting())) .collect(toList()); writeMeetingAssignmentList(personMeetingAssignmentList); }
currentRow.setHeightInPoints(Math.max(currentRow.getHeightInPoints(), talkList.size() * currentSheet.getDefaultRowHeightInPoints()));
void nextMeetingAssignmentListCell(List<MeetingAssignment> meetingAssignmentList, Function<MeetingAssignment, String> stringFunction, List<String> filteredConstraintNames) { if (meetingAssignmentList == null) { meetingAssignmentList = Collections.emptyList(); } HardMediumSoftScore score = meetingAssignmentList.stream() .map(indictmentMap::get).filter(Objects::nonNull) .flatMap(indictment -> indictment.getConstraintMatchSet().stream()) // Filter out filtered constraints .filter(constraintMatch -> filteredConstraintNames == null || filteredConstraintNames.contains(constraintMatch.getConstraintName())) .map(constraintMatch -> (HardMediumSoftScore) constraintMatch.getScore()) // Filter out positive constraints .filter(indictmentScore -> !(indictmentScore.getHardScore() >= 0 && indictmentScore.getSoftScore() >= 0)) .reduce(Score::add).orElse(HardMediumSoftScore.ZERO); XSSFCell cell = getXSSFCellOfScore(score); if (!meetingAssignmentList.isEmpty()) { ClientAnchor anchor = creationHelper.createClientAnchor(); anchor.setCol1(cell.getColumnIndex()); anchor.setCol2(cell.getColumnIndex() + 4); anchor.setRow1(currentRow.getRowNum()); anchor.setRow2(currentRow.getRowNum() + 4); Comment comment = currentDrawing.createCellComment(anchor); String commentString = getMeetingAssignmentListString(meetingAssignmentList); comment.setString(creationHelper.createRichTextString(commentString)); cell.setCellComment(comment); } cell.setCellValue(meetingAssignmentList.stream().map(stringFunction).collect(joining("\n"))); currentRow.setHeightInPoints(Math.max(currentRow.getHeightInPoints(), meetingAssignmentList.size() * currentSheet.getDefaultRowHeightInPoints())); }
private void writeRoomsView() { nextSheet("Rooms view", 1, 2, true); nextRow(); nextHeaderCell(""); writeTimeGrainDaysHeaders(); nextRow(); nextHeaderCell("Room"); writeTimeGrainHoursHeaders(); for (Room room : solution.getRoomList()) { nextRow(); currentRow.setHeightInPoints(2 * currentSheet.getDefaultRowHeightInPoints()); nextCell().setCellValue(room.getName()); List<MeetingAssignment> roomMeetingAssignmentList = solution.getMeetingAssignmentList().stream() .filter(meetingAssignment -> meetingAssignment.getRoom() == room).collect(toList()); writeMeetingAssignmentList(roomMeetingAssignmentList); } autoSizeColumnsWithHeader(); }
for (Room room : solution.getRoomList()) { nextRow(); currentRow.setHeightInPoints(3 * currentSheet.getDefaultRowHeightInPoints()); nextCell().setCellValue(room.getName()); List<Talk> roomTalkList = solution.getTalkList().stream()
/** * Get the default row height for the sheet (if the rows do not define their own height) in * twips (1/20 of a point) * * @return default row height */ public short getDefaultRowHeight() { return (short)(getDefaultRowHeightInPoints() * 20); }
/** * Get the default row height for the sheet (if the rows do not define their own height) in * twips (1/20 of a point) * * @return default row height */ @Override public short getDefaultRowHeight() { return (short)(getDefaultRowHeightInPoints() * TWIPS_PER_POINT); }
/** * Get the default row height for the sheet (if the rows do not define their own height) in * points. * * @return default row height in points */ @Override public float getDefaultRowHeightInPoints() { return _sh.getDefaultRowHeightInPoints(); }
/** * Get the default row height for the sheet (if the rows do not define their own height) in * points. * * @return default row height in points */ public float getDefaultRowHeightInPoints() { return _sh.getDefaultRowHeightInPoints(); }
private float computeRowHeightInPoints(int fontSizeInPoints, int numLines, XSSFSheet sheet) { float lineHeightInPoints = 1.3f * fontSizeInPoints; float rowHeightInPoints = lineHeightInPoints * numLines; rowHeightInPoints = Math.round(rowHeightInPoints * 4) / 4f; float defaultRowHeightInPoints = sheet.getDefaultRowHeightInPoints(); if (rowHeightInPoints < defaultRowHeightInPoints + 1) { rowHeightInPoints = defaultRowHeightInPoints; } return rowHeightInPoints; } }
/** * @param sheet * @param row * @return height in twips (1/20th of point) for row or default */ private static float getRowHeight(XSSFSheet sheet, int row) { XSSFRow r = sheet.getRow(row); return r == null ? sheet.getDefaultRowHeightInPoints() : r.getHeightInPoints(); }
/** * Returns row height measured in point size. If the height is not set, the default worksheet value is returned, * See {@link org.apache.poi.xssf.usermodel.XSSFSheet#getDefaultRowHeightInPoints()} * * @return row height measured in point size * @see org.apache.poi.xssf.usermodel.XSSFSheet#getDefaultRowHeightInPoints() */ public float getHeightInPoints() { if (this._row.isSetHt()) { return (float) this._row.getHt(); } return _sheet.getDefaultRowHeightInPoints(); }
private void writeTimeslotHoursVertically(List<Timeslot> dayTimeslotList) { for (Timeslot timeslot : dayTimeslotList) { nextRow(); nextCell().setCellValue(TIME_FORMATTER.format(timeslot.getStartDateTime()) + "-" + TIME_FORMATTER.format(timeslot.getEndDateTime())); currentRow.setHeightInPoints(3 * currentSheet.getDefaultRowHeightInPoints()); } }
private float getRowHeightInPixels(int rowIndex){ XSSFSheet sheet = (XSSFSheet)getDrawing().getParent(); XSSFRow row = sheet.getRow(rowIndex); float height = row != null ? row.getHeightInPoints() : sheet.getDefaultRowHeightInPoints(); return height*PIXEL_DPI/POINT_DPI; }
public PdfContainer createEmptyRow(XSSFSheet sheet, Range verticalRange) { PdfContainer node = new PdfContainer(sheet, verticalRange); node.setHeigthEstimator(new Constant(sheet.getDefaultRowHeightInPoints())); node.setWidthEstimator(new Constant(0f)); node.setProcessor(new DefaultRowProcessor(node)); node.setRenderer(new DefaultRowRenderer(node)); node.setNotifier(new NoOpNotifier()); return node; }