我正在创建一个 Word 文档,以便将其与 Aspose 一起使用来生成文档。
我需要添加条件
<<if>>
和每个循环:
我试过了:
<<foreach CustomerDetails>>
<<if firstName != null>> First Name: <<firstName>> <<else>> First Name: Not Provided <<endif>>
<<if lastName != null>> Last Name: <<lastName>> <<else>> Last Name: Not Provided <<endif>>
<<endforeach>>
<<if CustomerDetails.size() == 0>> No customer details available. <<endif>>
但是我尝试的所有语法都失败了。
有人可以帮忙吗?
<<if [CustomerDetails != null && !CustomerDetails.isEmpty()]>><<foreach [customer in CustomerDetails]>> First Name: <<[customer.firstName]>>
Last Name: <<[customer.lastName]>>
Email Address: <<[customer.emailAddress]>>
<</foreach>>
<</if>>
..我在java中使用这个语法
ReportingEngine engine = new ReportingEngine();
engine.buildReport(doc, customerData);