Search in sources :

Example 1 with LocalDateTimeDateConverter

use of com.alibaba.excel.converters.localdatetime.LocalDateTimeDateConverter in project citrus by Yiuman.

the class WebUtils method exportExcel.

/**
 * 动态列导出Excel
 *
 * @param response 响应
 * @param headers  表头
 * @param data     数据
 * @param name     文件 名
 * @throws IOException IO异常
 */
public static void exportExcel(HttpServletResponse response, List<List<String>> headers, List<List<Object>> data, String name) throws IOException {
    addExportFilenameHeaders(response, name + ".xls");
    response.setContentType(APPLICATION_VND_MS_EXCEL);
    EasyExcel.write(response.getOutputStream()).registerConverter(new LocalDateTimeDateConverter()).head(headers).registerWriteHandler(new LongestMatchColumnWidthStyleStrategy()).sheet("sheet1").doWrite(data);
}
Also used : LocalDateTimeDateConverter(com.alibaba.excel.converters.localdatetime.LocalDateTimeDateConverter) LongestMatchColumnWidthStyleStrategy(com.alibaba.excel.write.style.column.LongestMatchColumnWidthStyleStrategy)

Example 2 with LocalDateTimeDateConverter

use of com.alibaba.excel.converters.localdatetime.LocalDateTimeDateConverter in project easyexcel by alibaba.

the class DefaultConverterLoader method initDefaultWriteConverter.

private static void initDefaultWriteConverter() {
    defaultWriteConverter = MapUtils.newHashMapWithExpectedSize(40);
    putWriteConverter(new BigDecimalNumberConverter());
    putWriteConverter(new BigIntegerNumberConverter());
    putWriteConverter(new BooleanBooleanConverter());
    putWriteConverter(new ByteNumberConverter());
    putWriteConverter(new DateDateConverter());
    putWriteConverter(new LocalDateTimeDateConverter());
    putWriteConverter(new DoubleNumberConverter());
    putWriteConverter(new FloatNumberConverter());
    putWriteConverter(new IntegerNumberConverter());
    putWriteConverter(new LongNumberConverter());
    putWriteConverter(new ShortNumberConverter());
    putWriteConverter(new StringStringConverter());
    putWriteConverter(new FileImageConverter());
    putWriteConverter(new InputStreamImageConverter());
    putWriteConverter(new ByteArrayImageConverter());
    putWriteConverter(new BoxingByteArrayImageConverter());
    putWriteConverter(new UrlImageConverter());
    // In some cases, it must be converted to string
    putWriteStringConverter(new BigDecimalStringConverter());
    putWriteStringConverter(new BigIntegerStringConverter());
    putWriteStringConverter(new BooleanStringConverter());
    putWriteStringConverter(new ByteStringConverter());
    putWriteStringConverter(new DateStringConverter());
    putWriteStringConverter(new LocalDateTimeStringConverter());
    putWriteStringConverter(new DoubleStringConverter());
    putWriteStringConverter(new FloatStringConverter());
    putWriteStringConverter(new IntegerStringConverter());
    putWriteStringConverter(new LongStringConverter());
    putWriteStringConverter(new ShortStringConverter());
    putWriteStringConverter(new StringStringConverter());
    putWriteStringConverter(new BigIntegerStringConverter());
}
Also used : DateDateConverter(com.alibaba.excel.converters.date.DateDateConverter) IntegerNumberConverter(com.alibaba.excel.converters.integer.IntegerNumberConverter) BigIntegerNumberConverter(com.alibaba.excel.converters.biginteger.BigIntegerNumberConverter) IntegerStringConverter(com.alibaba.excel.converters.integer.IntegerStringConverter) BigIntegerStringConverter(com.alibaba.excel.converters.biginteger.BigIntegerStringConverter) StringStringConverter(com.alibaba.excel.converters.string.StringStringConverter) BoxingByteArrayImageConverter(com.alibaba.excel.converters.bytearray.BoxingByteArrayImageConverter) BooleanStringConverter(com.alibaba.excel.converters.booleanconverter.BooleanStringConverter) BigDecimalStringConverter(com.alibaba.excel.converters.bigdecimal.BigDecimalStringConverter) LongStringConverter(com.alibaba.excel.converters.longconverter.LongStringConverter) BigIntegerNumberConverter(com.alibaba.excel.converters.biginteger.BigIntegerNumberConverter) LongNumberConverter(com.alibaba.excel.converters.longconverter.LongNumberConverter) BigIntegerStringConverter(com.alibaba.excel.converters.biginteger.BigIntegerStringConverter) FloatNumberConverter(com.alibaba.excel.converters.floatconverter.FloatNumberConverter) FileImageConverter(com.alibaba.excel.converters.file.FileImageConverter) BoxingByteArrayImageConverter(com.alibaba.excel.converters.bytearray.BoxingByteArrayImageConverter) ByteArrayImageConverter(com.alibaba.excel.converters.bytearray.ByteArrayImageConverter) DoubleStringConverter(com.alibaba.excel.converters.doubleconverter.DoubleStringConverter) ShortStringConverter(com.alibaba.excel.converters.shortconverter.ShortStringConverter) ShortNumberConverter(com.alibaba.excel.converters.shortconverter.ShortNumberConverter) DoubleNumberConverter(com.alibaba.excel.converters.doubleconverter.DoubleNumberConverter) LocalDateTimeDateConverter(com.alibaba.excel.converters.localdatetime.LocalDateTimeDateConverter) ByteStringConverter(com.alibaba.excel.converters.byteconverter.ByteStringConverter) UrlImageConverter(com.alibaba.excel.converters.url.UrlImageConverter) FloatStringConverter(com.alibaba.excel.converters.floatconverter.FloatStringConverter) BooleanBooleanConverter(com.alibaba.excel.converters.booleanconverter.BooleanBooleanConverter) DateStringConverter(com.alibaba.excel.converters.date.DateStringConverter) InputStreamImageConverter(com.alibaba.excel.converters.inputstream.InputStreamImageConverter) BigDecimalNumberConverter(com.alibaba.excel.converters.bigdecimal.BigDecimalNumberConverter) ByteNumberConverter(com.alibaba.excel.converters.byteconverter.ByteNumberConverter) LocalDateTimeStringConverter(com.alibaba.excel.converters.localdatetime.LocalDateTimeStringConverter)

Aggregations

LocalDateTimeDateConverter (com.alibaba.excel.converters.localdatetime.LocalDateTimeDateConverter)2 BigDecimalNumberConverter (com.alibaba.excel.converters.bigdecimal.BigDecimalNumberConverter)1 BigDecimalStringConverter (com.alibaba.excel.converters.bigdecimal.BigDecimalStringConverter)1 BigIntegerNumberConverter (com.alibaba.excel.converters.biginteger.BigIntegerNumberConverter)1 BigIntegerStringConverter (com.alibaba.excel.converters.biginteger.BigIntegerStringConverter)1 BooleanBooleanConverter (com.alibaba.excel.converters.booleanconverter.BooleanBooleanConverter)1 BooleanStringConverter (com.alibaba.excel.converters.booleanconverter.BooleanStringConverter)1 BoxingByteArrayImageConverter (com.alibaba.excel.converters.bytearray.BoxingByteArrayImageConverter)1 ByteArrayImageConverter (com.alibaba.excel.converters.bytearray.ByteArrayImageConverter)1 ByteNumberConverter (com.alibaba.excel.converters.byteconverter.ByteNumberConverter)1 ByteStringConverter (com.alibaba.excel.converters.byteconverter.ByteStringConverter)1 DateDateConverter (com.alibaba.excel.converters.date.DateDateConverter)1 DateStringConverter (com.alibaba.excel.converters.date.DateStringConverter)1 DoubleNumberConverter (com.alibaba.excel.converters.doubleconverter.DoubleNumberConverter)1 DoubleStringConverter (com.alibaba.excel.converters.doubleconverter.DoubleStringConverter)1 FileImageConverter (com.alibaba.excel.converters.file.FileImageConverter)1 FloatNumberConverter (com.alibaba.excel.converters.floatconverter.FloatNumberConverter)1 FloatStringConverter (com.alibaba.excel.converters.floatconverter.FloatStringConverter)1 InputStreamImageConverter (com.alibaba.excel.converters.inputstream.InputStreamImageConverter)1 IntegerNumberConverter (com.alibaba.excel.converters.integer.IntegerNumberConverter)1