类 AbstractJExcelView

  • 所有已实现的接口:
    Aware, BeanNameAware, ApplicationContextAware, ServletContextAware, View

    @Deprecated
    public abstract class AbstractJExcelView
    extends AbstractView
    已过时。
    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.
    从以下版本开始:
    1.2.5
    作者:
    Bram Smeets, Alef Arendsen, Juergen Hoeller
    另请参阅:
    AbstractExcelView, AbstractPdfView