My-FyiReporting icon indicating copy to clipboard operation
My-FyiReporting copied to clipboard

[WIP] Implement CanShrink and CanGrow attributes in RDLEngine

Open Copilot opened this issue 6 months ago • 0 comments

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:

  • [x] Analyze current CanGrow implementation in TableRow and List
  • [x] Implement CanShrink functionality for textboxes
  • [x] Fix CanGrow/CanShrink to properly adjust heights in Textbox, TableRow, and List
  • [x] Build and verify changes compile successfully
  • [x] 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 majorsilence/My-FyiReporting#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 avatar Oct 19 '25 19:10 Copilot