7 Replies Latest reply on Feb 23, 2009 8:29 AM by accless

    Excel generation from dataTable

    accless

      Hello all,


      first of all i would like to congratulate nicklas and daniel for their great work in writing the seam-excel api.
      Anyway, i have some comments and suggestions ;-)



      1) The Component excelexporter should have the install annotation with value BUILT IN for easier overwriting of this component. Unfortunately the default install level for missing install annotaion is APPLICATION. Maybe Seam will set the default level to BUILT IN some day....


      2) So far, all the columns are evaluated for the excel-sheet generation. But the datatable in the frontend might have more information (columns) than u actually need in your excel file, for instance the so called action/detail buttons/links. It would be nice that the api would evaluate the isRendered attribute of the UIColumn.


      From my point of view it would be nice to have a mehtod like this for easier extension:



             
              ...
              // Processes the columns
           List<javax.faces.component.UIColumn> columns = this.getColumnsToProcess(dataTable);
              ...
      
      
              /**
            * 
            * @return a list of columns to process for workbook generation
            */
           protected List<javax.faces.component.UIColumn> getColumnsToProcess(UIData dataTable) {
                List<javax.faces.component.UIColumn> columns = new ArrayList<javax.faces.component.UIColumn>(0);
                
                //Avoidance of CME
                for (javax.faces.component.UIColumn _column : ExcelComponent.getChildrenOfType(dataTable.getChildren(), javax.faces.component.UIColumn.class)) {
                     if (_column.isRendered()) {
                          columns.add(_column);
                     }
                }
                
                
                return columns;
           }
      
      



      3) Instead of throwing an exception i would love to have an empty xls file. In general the Exception-Handling should be custimizable like the Asynchronous-Dispatcher.



      Still, you guys did a great job!



      Greetings



      PS: how is it possible to contribute code or join you guys in developing this api (sorry for this newbie question, but i am a newbie ;-))

        • 1. Re: Excel generation from dataTable
          nickarls

          Thanks! Glad you find it useful


          1) Probably. Daniel, any comments?


          2) Yes. It should check the rendered attribute as it tries to look like the original datatable. Could you JIRA it for me? Or did you mean some other custom attribute that would enable a column to be visible on screen but not exported?


          3) In all cases? One option would be an attribute on workbook for switching it. I'm open for suggestions.


          Help is always appreciated and submitting patches is a good way to start. Please note though that we reserve the right to choose what goes in and what not ;-)

          • 2. Re: Excel generation from dataTable
            accless

            2) Yes. It should check the rendered attribute as it tries to look like the original datatable. Could you JIRA it for me? Or did you mean some other custom attribute that would enable a column to be visible on screen but not exported?


            As i said the rendered Attribute should of course be evaluated. (so far it is not)
            Furthermore - as most cases/sceneries should be covered - we could implement a method I earlier suggested. So the User has the most flexibility.
            I dont really see the button for opening a new issu on JIRA, so i havnt done it yet...



            3) In all cases? One option would be an attribute on workbook for switching it. I'm open for suggestions.


            Thats the point, you dont know what the desired behaviour in case of an exception is. so a custimisable exception handler might be a good idea or offering switching


            Greeting

            • 3. Re: Excel generation from dataTable
              nickarls

              You need to register/login to create new JIRAs

              • 4. Re: Excel generation from dataTable
                accless

                JBSEAM-3910

                • 5. Re: Excel generation from dataTable

                  Rene, thanks for your suggestions. I have assigned the Jira to me and will look at it!

                  • 6. Re: Excel generation from dataTable

                    1) and 2) fixed in trunk. Search example/doc for xls-column-export

                    • 7. Re: Excel generation from dataTable
                      accless

                      Coo, I will have a look at as soon as possible and evaluate this feature ;)