[WIP] Implement CanShrink and CanGrow attributes in RDLEngine
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:
-
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
-
TableRow.cs:
- Added
_CanShrinkflag and_ShrinkListto 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
- Added
-
List.cs:
- Added
_CanShrinkflag and_ShrinkListto 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
- Added
-
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:
-
CanGrow only (existing behavior improved):
- Textbox height = max(content height, defined height)
- TableRow/List calculates maximum needed height across all CanGrow textboxes
-
CanShrink only (new functionality):
- Textbox height = min(content height, defined height)
- TableRow/List calculates minimum needed height across all CanShrink textboxes
-
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.