We're sorry AsposeCloud doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.cloud

Build WORD report:Global variables in the for loop

Hi,I want to build a word report online.
I need to define global variables in the for loop so that I can do if judgment in the for loop.
Is there any way to do that?
(Attached is my code,Variable licenseInfo. License. LicenseInfoResult. SdnVersion in for loop is nullbuild_report2.zip (19.2 KB)


I am afraid I did not get your requirement. We will appreciate if you please share your current output and expected output documents as well. It will help us to understand your requirements and guide you.

build_reportv3.zip (54.9 KB)
image.png (5.9 KB)
Ok,I have added two files.


Thanks for sharing the additional information. We have tested the scenario and noticed the reported issue, so we logged a ticket(WORDSCLOUD-1785) for further investigation. We will notify you as soon as it is resolved.


Please note within a foreach loop, only the members of the elements are available.
To access data members of other elements, you must declare them as a variable in the template before the loop.

<<var [licenseInfoVar = licenseInfo]>>

And use this variable to data access in the loop.

<<if [element.sdn_infoItem.sdn_ver == licenseInfoVar.license.LicenseInfoResult.SdnVersion]>>no problem <<else>>Version inconsistency<</if>>

Please find the updated template and output for reference.

template_new_custom_modified.docx (20.2 KB)
Report_output.docx (15.9 KB)

I learned a lot!
Thank you

1 Like

The issues you have found earlier (filed as WORDSCLOUD-1785) have been fixed in this update. This message was posted using Bugs notification tool by Ivanov_John