8 Replies Latest reply on Oct 20, 2008 12:28 PM by nickarls

    Filtering Excel Cells

    volothamp

      Hello, using jboss-seam-excel is there any way to conditionally render a cell based on a property of the iterator variable?


      Something like:



      <e:worksheet value="#{results}" var="r">
                  <e:column>
                      <e:cell value="#{r.name}" rendered="#{r.shouldbeincluded == 'YES'}" />
                  </e:column>
      <e:column>




      I've tried using



      <s:fragment rendered="#{r.shouldbeincluded == 'YES'}""></s:fragment>
      



      But it didn't work.


      Thank you very much.


      Bye.

        • 1. Re: Filtering Excel Cells
          mdesignz

          Hello Luca,
          Not sure what your use case is, and I haven't tried what you posted above, but something like this should work:


          <e:cell value="#{r.shouldbeincluded == 'YES' ? r.name : ''}"

          • 2. Re: Filtering Excel Cells
            volothamp

            OOps, I'm sorry I was wrong.


            I mean that I want to filter a row, not a cell, based on a single element property.


            I used s:fragment before and after the e:column elements.


            Thank you.

            • 3. Re: Filtering Excel Cells
              nickarls

              Try filtering the data in the backing bean and file a JIRA if cells don't obey the rendered attribute.

              • 4. Re: Filtering Excel Cells
                volothamp

                Thank you very much. I'll make some tries and then eventually create a JIRA for this.


                Can i ask you another question?


                I'm trying to format excel using CSS files. In the documentation:



                The CSS attributes cascade down from parent to children and within one tag cascades over the CSS classes referenced in the styleClass  attributes and finally over the CSS attributes defined in the styleattribute. You can place them pretty much anywhere but e.g. placing a column width setting in a cell nested within that column makes little sense.

                So I've referenced my file using


                <e:workbook><e:link URL="/css/excel.css"/></e:workbook>


                and then


                <e:column styleClass="autosize" >


                in excel.css:


                .autosize {
                    xls-column-autosize:true;
                }


                This didn't work.
                Should I use class dot syntax, or there is another thing I'm not getting for css styleClass element?


                Would you please add to documentation a typical css for excel?


                • 5. Re: Filtering Excel Cells
                  nickarls

                  Fixed the rendered-attribute already, let's see if it makes 2.1.0.GA.


                  Looks OKish, have to take a look. The CSS stuff is pretty new so there are probably bugs (and the docs needs polishing, too). Does it react to using the style-attribute?

                  • 6. Re: Filtering Excel Cells
                    nickarls

                    Ngh(tm). Looks like I forgot to strip the leading dot when parsing the stylesheet, remove it in the css (or refer to it with styleClass=.autosize until I get it fixed...

                    • 7. Re: Filtering Excel Cells
                      volothamp

                      Another thing:


                      in Parser:175


                      String css = readCSS(new URL(URL)).toLowerCase();


                      You create a url from the URL property of UILink, which in the documentation is specified as a relative path. If you put a relative path, it throws a java.net.MalformedURLException.


                      I've resolved putting an absolute path in the url property.


                      <e:link URL="http://localhost:8080/exploded/myapp/excel.css"/>


                      Is this right?


                      Thank you.

                      • 8. Re: Filtering Excel Cells
                        nickarls

                        Already fixed in trunk/upcoming versions (there was a thread about it recently, can't find it now)