spring4.2中引入的Excel处理类

处理Excel文件使用的是Apache POI

http://poi.apache.org/spreadsheet/index.html

旧类:AbstractExcelView

http://docs.spring.io/spring/docs/4.2.2.BUILD-SNAPSHOT/javadoc-api//org/springframework/web/servlet/view/document/AbstractExcelView.html

新类:(Spring4.2以后引入)

AbstractXlsView 

AbstractXlsxView
AbstractXlsxStreamingView

关于Spring中视图类的更新, 作者说的一段话:

juergen.hoeller Juergen Hoeller added a comment - 23/Mar/15 9:46 AM

Based on your suggestions, I've introduced AbstractXlsView, AbstractXlsxView and AbstractXlsxStreamingView variants, designed to work as closely as possible with POI 3.8+'s arrangements. The traditional (pre POI 3.5) AbstractExcelView has been marked as deprecated, just like AbstractJExcelView already is.

I went with separate classes (in a hierarchy) primarily for minimum dependencies imposed, i.e. no poi-ooxml dependency needed when just using HSSF. As a side benefit, the content type can also be determined in the constructor then, and the SXSSFWorkbook.dispose call can be applied in a cleaner fashion.

This will be available in the upcoming 4.2 snapshot. Feel free to give it a try...

Note that AbstractXmlxStreamingView requires POI 3.9+ due to the pretty important SXSSFWorkbook.dispose() method only being available there.

We recommend the use of POI 3.10+ where we support close() calls for existing resources in a worksheet. We do that conditionally based on an instanceof Closeable check in order to preserve POI 3.5+ compatibility in AbstractXslView and AbstractXlsxView.

Juergen

Class AbstractXlsxStreamingView

http://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/web/servlet/view/document/AbstractXlsxStreamingView.html
 
jira.spring.io

猜你喜欢

转载自asjava.iteye.com/blog/2286394