| org.springframework.web.servlet.view.AbstractView org.springframework.web.servlet.view.document.AbstractJExcelView
AbstractJExcelView | abstract public class AbstractJExcelView extends AbstractView (Code) | | Convenient superclass for Excel document views.
This class uses the JExcelAPI instead of POI. More
information on JExcelAPI can be found on their website.
Properties:
- url (optional): The url of an existing Excel document to pick as a
starting point. It is done without localization part nor the .xls extension.
The file will be searched with locations in the following order:
- [url]_[language]_[country].xls
- [url]_[language].xls
- [url].xls
For working with the workbook in the subclass, see Java Excel API site
As an example, you can try this snippet:
protected void buildExcelDocument(Map model, WritableWorkbook workbook, HttpServletRequest request,
HttpServletResponse response) {
if (workbook.getNumberOfSheets() == 0) {
workbook.createSheet("Spring", 0);
}
WritableSheet sheet = workbook.getSheet("Spring");
Label label = new Label(0, 0, "This is a nice label");
sheet.addCell(label);
}
The use of this view is close to the AbstractExcelView class,
just using the JExcel API instead of the Apache POI API.
author: Bram Smeets author: Alef Arendsen author: Juergen Hoeller since: 1.2.5 See Also: AbstractExcelView See Also: AbstractPdfView |
AbstractJExcelView | public AbstractJExcelView()(Code) | | Default Constructor.
Sets the content type of the view to "application/vnd.ms-excel".
|
buildExcelDocument | abstract protected void buildExcelDocument(Map model, WritableWorkbook workbook, HttpServletRequest request, HttpServletResponse response) throws Exception(Code) | | Subclasses must implement this method to create an Excel Workbook
document, given the model.
Parameters: model - the model Map Parameters: workbook - the Excel workbook to complete Parameters: request - in case we need locale etc. Shouldn't look at attributes. Parameters: response - in case we need to set cookies. Shouldn't write to it. throws: Exception - in case of failure |
getTemplateSource | protected Workbook getTemplateSource(String url, HttpServletRequest request) throws Exception(Code) | | Create the workbook from an existing XLS document.
Parameters: url - the URL of the Excel template without localization part nor extension Parameters: request - current HTTP request the template workbook throws: Exception - in case of failure |
setUrl | public void setUrl(String url)(Code) | | Set the URL of the Excel workbook source, without localization part nor extension.
|
Fields inherited from org.springframework.web.servlet.view.AbstractView | final public static String DEFAULT_CONTENT_TYPE(Code)(Java Doc)
|
|
|