Class AbstractJExcelView

  • All Implemented Interfaces:
    Aware, BeanNameAware, ApplicationContextAware, ServletContextAware, View

    @Deprecated
    public abstract class AbstractJExcelView
    extends AbstractView
    Deprecated.
    as of Spring 4.0, since JExcelAPI is an abandoned project (no release since 2009, with serious bugs remaining)
    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<String, Object> 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.
    Since:
    1.2.5
    Author:
    Bram Smeets, Alef Arendsen, Juergen Hoeller
    See Also:
    AbstractExcelView, AbstractPdfView