4 Replies Latest reply on Sep 18, 2012 9:49 AM by mkouba

    Jboss seam excel and iteration

    puri

      Hello everyone,

       

      I'm using seam-excel 2.2.0.GA and i'm trying to do something simple like that :

      ex1.png

       

      It's just an iteration over an object list. Data1 is the first element of this list, Data2 the second, and so on.

      Each cells display a field of my bean and I do not want any data in the empty ones (A3, B3, A4, ...).

       

      Here is what my xhtml file looks like :

       

          <e:worksheet value="#{someBean.someList}" var="element" name="worksheet1">
      
            <e:column style="xls-column-autosize: true;">
              <f:facet name="header">
                <e:cell value="Title1" style="xls-font-size: 11; xls-font-bold: true;" />
              </f:facet>
              <e:cell value="#{element.field1}" />
              <e:cell value="" />
              <e:cell value="" />
              <e:cell value="" />
            </e:column>
      
            <e:column style="xls-column-autosize: true;">
              <f:facet name="header">
                <e:cell value="Title2" style="xls-font-size: 11; xls-font-bold: true;" />
              </f:facet>
              <e:cell value="#{element.field2}" />
              <e:cell value="" />
              <e:cell value="" />
              <e:cell value="" />
            </e:column>
      
            <e:column style="xls-column-autosize: true;">
              <f:facet name="header">
                <e:cell value="Title3" style="xls-font-size: 11; xls-font-bold: true;" />
              </f:facet>
              <e:cell value="#{element.field3}" />
              <e:cell value="#{element.field4}" />
              <e:cell value="#{element.field5}" />
              <e:cell value="#{element.field6}" />
            </e:column>
      
            <e:column style="xls-column-autosize: true;">
              <f:facet name="header">
                <e:cell value="Title4" style="xls-font-size: 11; xls-font-bold: true;" />
              </f:facet>
              <e:cell value="#{element.field7}" />
              <e:cell value="#{element.field8}" />
              <e:cell value="#{element.field9}" />
              <e:cell value="#{element.field10}" />
            </e:column>
      
          </e:worksheet>
      

       

      No matter what i try i can't get this work.

       

      Could someone help me on this ?

       

      Thanks.

        • 1. Re: Jboss seam excel and iteration
          puri

          Hello, i'm still stuck with this problem.

          Any idea ?

          • 2. Re: Jboss seam excel and iteration
            mkouba

            Hi, could you add some error description (stacktrace, etc.)? It's quite hard to guess the nature of your problem

            • 3. Re: Jboss seam excel and iteration
              puri

              There is no error, the xhtml works fine but the result is not what i want.

               

              For example, i'd like to iterate datas within a worksheet with a maximum of 4 columns. Each data has to display 15 fields in 15 cells and i want a newline after the 4th, 8th and 12th field.

              I tried adding the attribute columns="4" in worksheet tag but it didn't work.

               

              I'm sure there is a simple way to do this but i can't find it

              • 4. Re: Jboss seam excel and iteration
                mkouba

                Well, I'm no seam-excel specialist but if you want to place an empty cell, you will have to use something like (note the gap):

                <e:cell value=" " />

                ... because seam-excel skips empty cells (see org.jboss.seam.excel.jxl.JXLExcelWorkbook.addItem()). And it seems there is no option to define "regular" blank cell. Anyways you can always use JExcelApi directly and create your worksheets programatically.