提交 | 用户 | 时间
|
e7c126
|
1 |
package com.iailab.framework.excel.core.convert; |
H |
2 |
|
|
3 |
import com.iailab.framework.common.util.json.JsonUtils; |
|
4 |
import com.alibaba.excel.converters.Converter; |
|
5 |
import com.alibaba.excel.enums.CellDataTypeEnum; |
|
6 |
import com.alibaba.excel.metadata.GlobalConfiguration; |
|
7 |
import com.alibaba.excel.metadata.data.WriteCellData; |
|
8 |
import com.alibaba.excel.metadata.property.ExcelContentProperty; |
|
9 |
|
|
10 |
/** |
|
11 |
* Excel Json 转换器 |
|
12 |
* |
|
13 |
* @author iailab |
|
14 |
*/ |
|
15 |
public class JsonConvert implements Converter<Object> { |
|
16 |
|
|
17 |
@Override |
|
18 |
public Class<?> supportJavaTypeKey() { |
|
19 |
throw new UnsupportedOperationException("暂不支持,也不需要"); |
|
20 |
} |
|
21 |
|
|
22 |
@Override |
|
23 |
public CellDataTypeEnum supportExcelTypeKey() { |
|
24 |
throw new UnsupportedOperationException("暂不支持,也不需要"); |
|
25 |
} |
|
26 |
|
|
27 |
@Override |
|
28 |
public WriteCellData<String> convertToExcelData(Object value, ExcelContentProperty contentProperty, |
|
29 |
GlobalConfiguration globalConfiguration) { |
|
30 |
// 生成 Excel 小表格 |
|
31 |
return new WriteCellData<>(JsonUtils.toJsonString(value)); |
|
32 |
} |
|
33 |
|
|
34 |
} |