简体   繁体   中英

JXLS- jx:each with jx:if condition in same comment markup

Using jxls 2.9.0 i have a problem receiving a list in my excel template which is empty or null, so i need to combine a "jx:each" insiede a jx:if markup to evaluate the list, is it possible?

I have in the cell comment markup (to iterate the list):

jx:each(items="myList.items" var="item" lastCell="B3")

In the cell:

${item}

thanks in advance..

By this way i can use for each loop inside an if condition in markups:

    jx:if(condition="myList!=null && !myList.isEmpty()", lastCell="C8", areas=["C4:C4","C8:C8"] )
    jx:each(items="myList" var="item" lastCell="C4")

so, with this condition we avoid scrolling the columns to the left when the list is empty or null. Make sure to put the maximum size that the list could have in the if areas so that the cells do not overlap.

There is an example that works for me:

在此处输入图像描述

Result:

在此处输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM