Query on range and static legends data

I’m working on generating an Excel report using Aspose Cells for Java v25.9, combining an Excel template with JSON data. I’ve included my sample code, the template, and the generated output for you to easily reference. range-001.zip (17.0 KB)

My setup is quite simple: I have a main data range that needs to be dynamically populated, and right beside it (on the same row), there’s a legend. The first range has conditional formatting to use the legends. The first part of my dynamic range uses a smart marker like this:

&=RootData.Directors.ID(range:A2:C2)

This section is then followed by another data range directly below it.

The challenge I’m facing is this: When Aspose processes the first dynamic range and populates it with data from my JSON payload, it correctly inserts new rows as needed. However, this expansion is inadvertently affecting my legend. It inserts empty rows into the legend table, making it look broken and scattered. My goal is for all the legend entries to remain grouped together, neatly aligned at the top, right next to the data.

I’ve tried using the (range:A2:C2) parameter, hoping it would help manage the formatting, but it doesn’t seem to prevent this issue.

Am I missing a crucial setting or approach here? Is there a way to stop Aspose from inserting these empty rows into my legend area, ensuring everything stays perfectly aligned?

@sagaofsilence.dev

To address the issue of Aspose inserting empty rows into your legend when populating the dynamic range, consider the following approach:

  1. Separate Ranges: Ensure that your legend is defined in a separate range that is not directly adjacent to the dynamic data range. This can help prevent Aspose from affecting it during data population.

  2. Use Fixed Rows: Instead of using a dynamic range for the legend, you can define it as a fixed range. This way, Aspose will not attempt to adjust it based on the dynamic data.

  3. Adjust Smart Markers: Review your smart marker syntax. If possible, try using a different marker or method to control how data is populated, ensuring it does not interfere with the legend.

  4. Post-Processing: After generating the report, consider implementing a post-processing step to clean up any unintended empty rows in the legend area.

By implementing these strategies, you should be able to maintain the alignment of your legend while dynamically populating your data range.

Best regards,
Professionalize.Discourse Bot

@sagaofsilence.dev,

Thank you for sharing the template Excel file and JSON data file.

I tested your scenario using the provided template, JSON data, and code snippet, and I obtained the same output Excel file as the one you shared. If possible, could you please provide an Excel file with your expected results? This would help us better understand your requirements and allow us to address them more effectively.

out_expected.zip (7.3 KB)

PFA

@sagaofsilence.dev
By testing with sample files and code on the latest version v25.9, we can reproduce the issue. Empty rows are inserted into legend table when using the range parameter in smart marker.

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-46504

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.

@sagaofsilence.dev
If you only want to insert range not rows, please add shift SmartMarker.
employees-001.zip (6.5 KB)

@sagaofsilence.dev,

We are pleased to inform you that your (original) issue (Ticket ID: “CELLSJAVA-46504”) has been resolved. The fix/enhancement will be included in the upcoming release (Aspose.Cells v25.10) that we plan to release in the first half of October 2025. You will be notified in this thread once the new version is published.

1 Like