类 AbstractXlsView
- java.lang.Object
- org.springframework.context.support.ApplicationObjectSupport
- org.springframework.web.context.support.WebApplicationObjectSupport
- org.springframework.web.servlet.view.AbstractView
- org.springframework.web.servlet.view.document.AbstractXlsView
- 所有已实现的接口:
Aware
,BeanNameAware
,ApplicationContextAware
,ServletContextAware
,View
- 直接已知子类:
AbstractXlsxView
public abstract class AbstractXlsView extends AbstractView
Convenient superclass for Excel document views in traditional XLS format. Compatible with Apache POI 3.5 and higher.For working with the workbook in the subclass, see Apache's POI site
- 从以下版本开始:
- 4.2
- 作者:
- Juergen Hoeller
字段概要
从类继承的字段 org.springframework.web.servlet.view.AbstractView
DEFAULT_CONTENT_TYPE
从类继承的字段 org.springframework.context.support.ApplicationObjectSupport
logger
从接口继承的字段 org.springframework.web.servlet.View
PATH_VARIABLES, RESPONSE_STATUS_ATTRIBUTE, SELECTED_CONTENT_TYPE
构造器概要
构造器 构造器 说明 AbstractXlsView()
Default Constructor.
方法概要
所有方法 实例方法 抽象方法 具体方法 修饰符和类型 方法 说明 protected abstract void
buildExcelDocument(Map<String,Object> model, org.apache.poi.ss.usermodel.Workbook workbook, HttpServletRequest request, HttpServletResponse response)
Application-provided subclasses must implement this method to populate the Excel workbook document, given the model.protected org.apache.poi.ss.usermodel.Workbook
createWorkbook(Map<String,Object> model, HttpServletRequest request)
Template method for creating the POIWorkbook
instance.protected boolean
generatesDownloadContent()
Return whether this view generates download content (typically binary content like PDF or Excel files).protected void
renderMergedOutputModel(Map<String,Object> model, HttpServletRequest request, HttpServletResponse response)
Renders the Excel view, given the specified model.protected void
renderWorkbook(org.apache.poi.ss.usermodel.Workbook workbook, HttpServletResponse response)
The actual render step: taking the POIWorkbook
and rendering it to the given response.从类继承的方法 org.springframework.web.servlet.view.AbstractView
addStaticAttribute, createMergedOutputModel, createRequestContext, createTemporaryOutputStream, exposeModelAsRequestAttributes, getAttributesMap, getBeanName, getContentType, getRequestContextAttribute, getRequestToExpose, getStaticAttributes, isExposePathVariables, prepareResponse, render, setAttributes, setAttributesCSV, setAttributesMap, setBeanName, setContentType, setExposeContextBeansAsAttributes, setExposedContextBeanNames, setExposePathVariables, setRequestContextAttribute, setResponseContentType, toString, writeToResponse
从类继承的方法 org.springframework.web.context.support.WebApplicationObjectSupport
getServletContext, getTempDir, getWebApplicationContext, initApplicationContext, initServletContext, isContextRequired, setServletContext
从类继承的方法 org.springframework.context.support.ApplicationObjectSupport
getApplicationContext, getMessageSourceAccessor, initApplicationContext, requiredContextClass, setApplicationContext
构造器详细资料
AbstractXlsView
public AbstractXlsView()
Default Constructor. Sets the content type of the view to "application/vnd.ms-excel".
方法详细资料
generatesDownloadContent
protected boolean generatesDownloadContent()
从类复制的说明:AbstractView
Return whether this view generates download content (typically binary content like PDF or Excel files).The default implementation returns
false
. Subclasses are encouraged to returntrue
here if they know that they are generating download content that requires temporary caching on the client side, typically via the response OutputStream.
renderMergedOutputModel
protected final void renderMergedOutputModel(Map<String,Object> model, HttpServletRequest request, HttpServletResponse response) throws Exception
Renders the Excel view, given the specified model.- 指定者:
renderMergedOutputModel
在类中AbstractView
- 参数:
model
- combined output Map (nevernull
), with dynamic values taking precedence over static attributesrequest
- current HTTP requestresponse
- current HTTP response- 抛出:
Exception
- if rendering failed
createWorkbook
protected org.apache.poi.ss.usermodel.Workbook createWorkbook(Map<String,Object> model, HttpServletRequest request)
Template method for creating the POIWorkbook
instance.The default implementation creates a traditional
HSSFWorkbook
. Spring-provided subclasses are overriding this for the OOXML-based variants; custom subclasses may override this for reading a workbook from a file.- 参数:
model
- the model Maprequest
- current HTTP request (for taking the URL or headers into account)- 返回:
- the new
Workbook
instance
renderWorkbook
protected void renderWorkbook(org.apache.poi.ss.usermodel.Workbook workbook, HttpServletResponse response) throws IOException
The actual render step: taking the POIWorkbook
and rendering it to the given response.- 参数:
workbook
- the POI Workbook to renderresponse
- current HTTP response- 抛出:
IOException
- when thrown by I/O methods that we're delegating to
buildExcelDocument
protected abstract void buildExcelDocument(Map<String,Object> model, org.apache.poi.ss.usermodel.Workbook workbook, HttpServletRequest request, HttpServletResponse response) throws Exception
Application-provided subclasses must implement this method to populate the Excel workbook document, given the model.- 参数:
model
- the model Mapworkbook
- the Excel workbook to populaterequest
- in case we need locale etc. Shouldn't look at attributes.response
- in case we need to set cookies. Shouldn't write to it.- 抛出:
Exception