Search in sources :

Example 1 with AbstractHeadColumnWidthStyleStrategy

use of com.alibaba.excel.write.style.column.AbstractHeadColumnWidthStyleStrategy in project easyexcel by alibaba.

the class AbstractWriteHolder method dealColumnWidth.

private void dealColumnWidth(List<WriteHandler> handlerList) {
    WriteHandler columnWidthStyleStrategy = new AbstractHeadColumnWidthStyleStrategy() {

        @Override
        protected Integer columnWidth(Head head, Integer columnIndex) {
            if (head == null) {
                return null;
            }
            if (head.getColumnWidthProperty() != null) {
                return head.getColumnWidthProperty().getWidth();
            }
            return null;
        }
    };
    handlerList.add(columnWidthStyleStrategy);
}
Also used : AbstractHeadColumnWidthStyleStrategy(com.alibaba.excel.write.style.column.AbstractHeadColumnWidthStyleStrategy) Head(com.alibaba.excel.metadata.Head) WriteHandler(com.alibaba.excel.write.handler.WriteHandler) WorkbookWriteHandler(com.alibaba.excel.write.handler.WorkbookWriteHandler) RowWriteHandler(com.alibaba.excel.write.handler.RowWriteHandler) CellWriteHandler(com.alibaba.excel.write.handler.CellWriteHandler) SheetWriteHandler(com.alibaba.excel.write.handler.SheetWriteHandler)

Aggregations

Head (com.alibaba.excel.metadata.Head)1 CellWriteHandler (com.alibaba.excel.write.handler.CellWriteHandler)1 RowWriteHandler (com.alibaba.excel.write.handler.RowWriteHandler)1 SheetWriteHandler (com.alibaba.excel.write.handler.SheetWriteHandler)1 WorkbookWriteHandler (com.alibaba.excel.write.handler.WorkbookWriteHandler)1 WriteHandler (com.alibaba.excel.write.handler.WriteHandler)1 AbstractHeadColumnWidthStyleStrategy (com.alibaba.excel.write.style.column.AbstractHeadColumnWidthStyleStrategy)1