简体   繁体   English

JXLS- jx:each 和 jx:if 条件在相同的注释标记中

[英]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?使用 jxls 2.9.0 我在我的 excel 模板或 null 中接收列表时遇到问题,所以我需要在 jx:if 标记中组合一个“jx:each”来评估列表,这可能吗?

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:通过这种方式,我可以在标记中的 if 条件内使用每个循环:

    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.因此,在这种情况下,我们避免在列表为空或 null 时向左滚动列。 Make sure to put the maximum size that the list could have in the if areas so that the cells do not overlap.确保将列表可能具有的最大大小放在 if 区域中,以使单元格不重叠。

There is an example that works for me:有一个对我有用的例子:

在此处输入图像描述

Result:结果:

在此处输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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