com.github.xiao1wang.wordapp.config.PoiExtendConfig Maven / Gradle / Ivy
package com.github.xiao1wang.wordapp.config;
import com.deepoove.poi.config.Configure;
import com.deepoove.poi.config.ConfigureBuilder;
import com.github.xiao1wang.wordapp.renderpolicy.ChartRenderPolicy;
import com.github.xiao1wang.wordapp.renderpolicy.ListRenderPolicy;
import com.github.xiao1wang.wordapp.renderpolicy.TableRenderPolicy;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* 针对poi-tl提供的插件
* @author wangyahui
* @date 2020/3/20 15:20
*/
@Configuration
public class PoiExtendConfig {
@Bean("poiExtendTagConfig")
public Configure extendConfig() {
ConfigureBuilder builder = Configure.newBuilder();
// 定义word文档中使用的标签类型对应的插件
builder.addPlugin('&', new ChartRenderPolicy());
builder.addPlugin('%', new ListRenderPolicy());
builder.addPlugin('$', new TableRenderPolicy());
return builder.build();
}
}