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

Free Support Forum - aspose.com

Linq Reporting Engine - Accessing list element by its index


I’m using Java Aspose Reporting Engine and xml data source loaded as DataSet object,

Can I access a specific element of an array by its index? Without indexOf inside a foreach or skip() method?

My requirement is to use a simple syntax in this case, something like mentioned in the example expected code section

XML source

  <name>Person's Name</name>


<<foreach [in person]>>
    ### Working example (Workarounds)
    # index 0
    # index 3
    # Using foreach
    <<foreach [in person.address]>><<if [indexOf() == 3]>><<[street]>><</foreach>>
    ### Expected code (Not Working)
    # example index 3

Java 17 code

public class A {
  public static void B() {
        Document doc = new Document(DOC_PATH);
        var ds = new DataSet().readXml(XML_PATH);
        ReportingEngine engine = new ReportingEngine();
            ReportBuildOptions.REMOVE_EMPTY_PARAGRAPHS + 
        engine.buildReport(doc, ds, "doc");


First of all, syntax like <<[persong.get(1).street]>> does not work, because it should be <<[person.address.get(1).street]>>. However, if using syntax like that, an exception is thrown. But rewriting the expression in the following way resolves the issue: <<[person.address.get(1).get("street")]>>.

Sorry, i completely forgot about address element in the expected code example
The correct way was supposed to be <<[person.address.get(N).street]>>, <<[person.address[N].street]>> and so on, as you mentioned before.

It is possible to have this in the future? The following expression <<[person.address.get(1).get("street")]>> changes the original syntax of how templates are written, the get(“street”) method adds more logic to the document

Ps. I’ve tried <<[person.address.get(1).get("street")]>> and it’s not working.

Having an utility class, registered in the engine with

  public static String getType(Object something) {
    if (something == null) {
      return "Null element";
    return something.getClass().getName();

<<[Util.getType(<<[person.address.get(1))]>> returns “Null element”, and
<<[Util.getType(<<[person.address]>> returns aspose internal object class

@nhnatyshyn Thank you for additional information.
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): WORDSNET-25259

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.

The issues you have found earlier (filed as WORDSNET-25259) have been fixed in this Aspose.Words for Java 23.7 update.


We have added support of elementAt and elementAtOrDefault extension methods for enumerations to LINQ Reporting Engine template syntax. They can be used as follows: