Use expression from outside iteration inside the iteration

Hello
So I’m new to Aspose and was wondering if it is possible to use an expression, that is outside an iteration, inside an iteration.

For example:

<<[Points]>> 
<<foreach [item in List]>>
  <<[item.Textfield]>> <<[Points]>>              <-- Can I somehow use "Points" inside the foreach?
<< /foreach>>

@Yachti Sure, you can access expression outside the iteration. For example see the following template and code:

List<string> list = new List<string>() { "First", "Second", "Third" };

Document doc = new Document(@"C:\Temp\in.docx");
ReportingEngine engine = new ReportingEngine();
engine.BuildReport(doc, new object[] { 100, list }, new string[] { "Points", "List" });
doc.Save(@"C:\Temp\out.docx");

in.docx (12.7 KB)
out.docx (10.0 KB)

1 Like