Skip to content

[WIP] Implement CanShrink and CanGrow attributes in RDLEngine#253

Draft
Copilot wants to merge 3 commits intomasterfrom
copilot/implement-canshrink-cangrow
Draft

[WIP] Implement CanShrink and CanGrow attributes in RDLEngine#253
Copilot wants to merge 3 commits intomasterfrom
copilot/implement-canshrink-cangrow

Conversation

Copy link
Contributor

Copilot AI commented Oct 19, 2025

Implementing CanGrow and CanShrink attributes for RDL textboxes

Understanding of the Issue:

  • CanShrink: When a textbox is empty or has no display, empty rows are still rendered instead of being removed
  • CanGrow: When text wraps to multiple lines, bottom elements don't move down and text overwrites the next element

Implementation Plan:

  • Analyze current CanGrow implementation in TableRow and List
  • Implement CanShrink functionality for textboxes
  • Fix CanGrow/CanShrink to properly adjust heights in Textbox, TableRow, and List
  • Build and verify changes compile successfully
  • Create test structure (tests need proper data provider setup to run)
  • Matrix implementation (complex, separate task)

Changes Made:

  1. Textbox.cs (RunPage method):

    • Modified height calculation to respect both CanGrow and CanShrink
    • Calculate height for both CanGrow and CanShrink conditions
    • Apply appropriate logic: CanShrink uses minimum, CanGrow uses maximum
    • When only CanShrink: height <= defined height
    • When only CanGrow: height >= defined height
    • When both: height can be any size based on content
  2. TableRow.cs:

    • Added _CanShrink flag and _ShrinkList to track textboxes with CanShrink
    • Updated FinalPass() to identify and track CanShrink textboxes
    • Modified HeightOfRow() to calculate height considering both CanGrow and CanShrink
    • Logic: CanGrow-only allows growth, CanShrink-only allows shrinking, both allow either
  3. List.cs:

    • Added _CanShrink flag and _ShrinkList to track textboxes with CanShrink
    • Updated FinalPass() to identify and track CanShrink textboxes
    • Modified HeightOfList() to calculate height considering both CanGrow and CanShrink
    • Same logic as TableRow for height calculation
  4. Test Infrastructure:

    • Created CanGrowCanShrinkTest.rdl test report with table and standalone textboxes
    • Created CanGrowCanShrinkTests.cs test file
    • Tests demonstrate CanGrow with long text and CanShrink with empty text

Build Status:

  • ✅ RdlEngine builds successfully with no errors
  • ✅ ReportTests build successfully
  • ℹ️ Test data provider needs proper configuration (separate task)

How It Works:

The implementation handles three scenarios:

  1. CanGrow only (existing behavior improved):

    • Textbox height = max(content height, defined height)
    • TableRow/List calculates maximum needed height across all CanGrow textboxes
  2. CanShrink only (new functionality):

    • Textbox height = min(content height, defined height)
    • TableRow/List calculates minimum needed height across all CanShrink textboxes
  3. Both CanGrow and CanShrink (new functionality):

    • Textbox height = content height (unrestricted)
    • TableRow/List considers both grow and shrink textboxes to find optimal height

Next Steps:

  • Users can test with their reports to validate behavior
  • Matrix implementation could be added in future (more complex refactoring needed)
  • Additional test data setup for automated validation
Original prompt

This section details on the original issue you should resolve

<issue_title>CanShrink and CanGrow attributes are not implemented</issue_title>
<issue_description>CanShrink is not implemeted in RDLEngine: if field is set to no display, empty rows are rendered.
According to rdl spec this empty space shoudl be removed.

Same for CanGrow: if field has CanGrow attribute set and text wraps to multiple lines, bottom elemens should move down.
Currently text overwrites next element.
</issue_description>

Comments on the Issue (you are @copilot in this section)

@majorsilence Note to self or anyone else: RdlViewer\RdlViewr.cs is a good place to start investigating this issue.

Fixes #10


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 2 commits October 19, 2025 19:50
Co-authored-by: majorsilence <656288+majorsilence@users.noreply.github.com>
Co-authored-by: majorsilence <656288+majorsilence@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CanShrink and CanGrow attributes are not implemented

2 participants