首页 > 解决方案 > Apache POI excel如何为单元格应用文本左上缩进

问题描述

如何在 Apache POI 中添加左上缩进与左文本对齐?

我目前拥有的:

 private CellStyle setDateAndTimeCellStyle(XSSFWorkbook workbook, Font font) {

    CellStyle dateCellStyle = workbook.createCellStyle();
    dateCellStyle.setWrapText(true);
    dateCellStyle.setAlignment(CellStyle.ALIGN_LEFT);
    dateCellStyle.setIndention(CellStyle.VERTICAL_TOP);
    dateCellStyle.setFont(font);
    dateCellStyle.setBorderTop(CellStyle.BORDER_THIN);
    dateCellStyle.setBorderLeft(CellStyle.BORDER_THIN);
    dateCellStyle.setBorderRight(CellStyle.BORDER_THIN);
    return dateCellStyle;
}

CellStyle dateCellStyle = setDateAndTimeCellStyle(workbook, font);

标签: apache-poialignmentindentation

解决方案


推荐阅读