In the Word template, we can access specific array elements using elementAt function.
I wanted to know if we can achieve the same functionality in the Excel template too.
I tried the following smart markers to output the details of the first director from the employees JSON data:
&=RootData.Directors.elementAt(0).id
&=RootData.Directors[0].id
But it did not work for me as expected.
Let me know if accessing array data in JSON input is possible using a smart marker.
Code snippet to allow two cell ranges in the same worksheet:
The attached zip file contains:
excel template, input JSON file, and output Excel file.
The output file has 2 worksheets.
The first worksheet has 2 tables for directors. I intend to output details of the first director.
But output has the smart markers instead of the data.
You can see the second worksheet, which outputs all directors’ data. employees_array_index.zip (27.2 KB)
@sagaofsilence.dev
Sorry, currently cells do not support accessing elements through array indexes in Excel templates. As a temporary solution, you can separate a certain element in the array and then build the data one by one in the template file.
Unfortunately, that option is not feasible. Our service caters to users with diverse needs, which means that users will likely create templates tailored to their specific domains. We have also observed that accessing particular elements of an array is a common requirement. Such elements are accessed as a single data or inside a loop.
@sagaofsilence.dev
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): CELLSJAVA-46284
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.
I am afraid, we do not upload fixes to Maven repositories; only official releases are published there. Additionally, fixes are provided exclusively to users with paid support. General users may need to wait for the official releases to come out. Please wait for Aspose.Cells for Java v25.3, which is scheduled for release in the first half of March. You will be notified as soon as the new version becomes available.
@sagaofsilence.dev
Please try the smart marker with [] to export specific data as follows:
&=RootData.Directors[1].reportees.FirstName : Export the second Director
&=RootData.Directors[2:-1].reportees.id : Export the Directors from the third to end
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
Enables storage, such as cookies, related to analytics.
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.