Spring Framework
  1. Spring Framework
  2. SPR-6898

AbstractExcelView support for XSSFWorkbook (xmlx format; POI 3.5+)

    Details

    • Type: Improvement Improvement
    • Status: Open
    • Priority: Minor Minor
    • Resolution: Unresolved
    • Affects Version/s: 3.1.1
    • Fix Version/s: 4.x Backlog
    • Component/s: Web
    • Labels:
      None
    • Last commented by a User:
      false

      Description

      I think it's a good improvement if buildExcelDocument can use the new XSSFWorkbook class, XSSF is the POI Project's pure Java implementation of the Excel 2007 OOXML (.xlsx) file format.
      Many people are beginning to use this new format, this is a default with Office 2007.

        Activity

        Hide
        Kevin Zogg added a comment -

        I found this issue while searching for a way to use XSSF with the built-in AbstractExcelView. After a while I decided to modify the AbstractExcelView, so that it would support both formats at once. The attached file is the result of my work with it.

        Explanations:

        • I removed some utility methods, because I felt like it would just not fit there. You have (at least I did) to write your own Util class anyway to keep the code clean and easy.
        • I added the method 'createWorkbook' which you have to override. This is where you decide if you want HSSF or XSSF.
        • Content type will be set automatically.
        • I removed the whole template stuff. As the caller is now responsible to create the workbook, it's easy to create one based on a template file (new XSSFWorkbook(resource.getInputStream())

        I hope this helps someone. Feel free to change anything you want

        Show
        Kevin Zogg added a comment - I found this issue while searching for a way to use XSSF with the built-in AbstractExcelView. After a while I decided to modify the AbstractExcelView, so that it would support both formats at once. The attached file is the result of my work with it. Explanations: I removed some utility methods, because I felt like it would just not fit there. You have (at least I did) to write your own Util class anyway to keep the code clean and easy. I added the method 'createWorkbook' which you have to override. This is where you decide if you want HSSF or XSSF. Content type will be set automatically. I removed the whole template stuff. As the caller is now responsible to create the workbook, it's easy to create one based on a template file (new XSSFWorkbook(resource.getInputStream()) I hope this helps someone. Feel free to change anything you want
        Hide
        Rossen Stoyanchev added a comment -

        The current version of POI we build against 3.0.2, now almost 4 years old does not have XSSFWorkbook, so it would be a good time for an upgrade of that dependency.

        Show
        Rossen Stoyanchev added a comment - The current version of POI we build against 3.0.2, now almost 4 years old does not have XSSFWorkbook, so it would be a good time for an upgrade of that dependency.

          People

          • Assignee:
            Juergen Hoeller
            Reporter:
            Matteo Zardini
            Last updater:
            Juergen Hoeller
          • Votes:
            6 Vote for this issue
            Watchers:
            7 Start watching this issue

            Dates

            • Created:
              Updated:
              Days since last comment:
              2 years, 6 weeks, 2 days ago