Files
jdescopingtool/openspec/changes/archive/2026-01-01-implement-excel-export/proposal.md
T
Joseph Doherty 26ff8d9b4f Initial commit: JDE Scoping Tool migration project
Set up repository with legacy .NET Framework 4.8 source (OLD/),
new .NET 10 Blazor solution (NEW/), OpenSpec specifications,
documentation, and project configuration.
2026-01-02 07:43:29 -05:00

85 lines
4.4 KiB
Markdown

# Implement Excel Export
## Summary
Implement the Excel export subsystem that generates multi-sheet Excel workbooks (.xlsx) containing search results and criteria documentation using the ClosedXML library on .NET 10. This phase provides an injectable `IExcelExportService` that transforms search data into formatted, protected spreadsheets with conditional sheet generation based on search options (MIS data extraction).
## Scope
### In Scope
- `IExcelExportService` interface and `ExcelExportService` implementation
- `ExcelExportOptions` configuration class with protection passwords
- Search Criteria sheet generator with filter tables
- Search Results sheet generator with attribute-driven columns
- MIS Info sheet generator (conditional on ExtractMisData)
- Investigation sheet generator (conditional on ExtractMisData)
- Worksheet protection with configurable passwords
- Attribute-driven column configuration (`OutputColumnAttribute`, `OutputTableAttribute`)
- Data entry template generator for bulk upload
- Header cell formatting utilities
- Service registration extension method (`AddExcelExport`)
- Unit tests with xUnit, Shouldly, and NSubstitute
### Out of Scope
- API endpoints for Excel download (Phase 8: web-api-auth)
- Search result storage/retrieval (Phase 6: search-processing)
- SignalR progress updates (Phase 8: web-api-auth)
- File system storage of exports (results stored as byte[] in database)
- Streaming exports for very large files (deferred to future optimization)
## Motivation
The Excel export subsystem is a core deliverable of the JDE Scoping Tool. Users depend on well-formatted Excel reports containing:
- Complete search criteria documentation for audit trails
- Work order results with status, quantities, and inclusion reasons
- MIS (Manufacturing Information System) data for quality analysis
- Investigation data for router mismatch analysis
Migrating from EPPlus (which requires commercial license in v7+) to ClosedXML (MIT license) eliminates licensing concerns while maintaining comparable functionality.
## Acceptance Criteria
1. `IExcelExportService.GenerateAsync()` produces valid .xlsx files
2. Workbooks contain correct sheets based on `ExtractMisData` flag:
- Standard export: 2 sheets (Search Criteria, Search Results)
- Full export: 4 sheets (+ MIS Info, Investigation)
3. All column definitions match legacy output exactly:
- Search Results: 19 columns with correct headers and formats
- MIS Info: 19 columns with wrapped text columns
- Investigation: 12 columns with date formatting
4. Worksheet protection applied with correct passwords from configuration
5. Filter tables use Light18 table style with Gainsboro headers
6. Auto-fit columns with correct padding (15% for criteria, 30% for data)
7. Wrapped text columns (Test Description, Tools & Gauges, Work Instructions) use fixed 65-character width
8. Inclusion reason computed correctly from boolean flags
9. Service registered correctly via `AddExcelExport()` extension method
10. Unit tests achieve >90% code coverage
11. `openspec validate implement-excel-export --strict` passes
## Dependencies
| Phase | Dependency | Type |
|-------|------------|------|
| Phase 3: implement-domain-models | `SearchModel`, `SearchResult`, `MisSearchResult`, `MisNonMatchSearchResult` | Required |
| Phase 6: implement-search-processing | Populated search results for testing | Soft dependency (can mock) |
**Note:** This phase can proceed in parallel with Phase 6 by mocking search results in tests. The `SearchModel` and result types must be defined first.
## Risks
| Risk | Likelihood | Impact | Mitigation |
|------|------------|--------|------------|
| ClosedXML API differences from EPPlus | Medium | Medium | Cross-reference ClosedXML documentation; create API mapping guide in design.md |
| Memory pressure with large exports | Low | High | Monitor memory usage; document streaming approach for future optimization |
| Protection password exposure | Low | Medium | Store passwords in configuration, document in security notes |
| Column order/format mismatch | Medium | High | Generate comparison spreadsheets; verify against legacy output |
## Related Specs
- `excel-export/spec.md` - Base specification for Excel export subsystem
- `domain-models/spec.md` - Domain models including SearchModel and result types
- `search-processing/spec.md` - Search processing that produces results for export