DiseaseComparisonReport
Takes the five Checking bundles a DiseaseComparison answers and renders them on the __compRep worksheet through CheckingOutput. The class holds the workbook and the sheet name; the sheet itself is resolved on every render.
ONE REPORT AT A TIME
The sheet is cleared before anything is written, so an old report never survives a new run. The clear takes the row marker CheckingOutput keeps in the sheet names with it, so the next render initialises the sheet again: the font, the header formatting and the hidden column widths come back with the first output row, and the sheet ends up carrying the last comparison alone.
PROTECTION AND VISIBILITY
__compRep sits outside the protection matrix of the master setup. The deploy step protects Variables, Choices and the translations sheet alone (EventsMasterSetupRibbon), so the clear needs no unprotect. That same step hides __compRep, so the sheet is made visible again before the render starts.
Internal members (not exported)
Factory
Create #
Build a writer bound to a workbook.
Signature:
Public Function Create(ByVal hostBook As Workbook, _
Optional ByVal reportSheetName As String = REPORT_SHEET_NAME) As DiseaseComparisonReport
Parameters:
hostBook: Workbook. The master setup workbook carrying the report sheet.reportSheetName: Optional String. Report worksheet. Defaults to "__compRep".
Returns: DiseaseComparisonReport ready to render.
Accessors
SheetName #
Name of the worksheet the report is written on.
Signature:
Public Property Get SheetName() As String
ReportSheet #
The report worksheet.
Signature:
Public Property Get ReportSheet() As Worksheet
Raises ElementNotFound when the workbook carries no such sheet.
Output
PrintReport #
Render a comparison on the report worksheet.
Signature:
Public Sub PrintReport(ByVal comparison As DiseaseComparison)
Clears the sheet, prints the five bundles the comparison answers, installs the worksheet change handler that drives the filter, and activates the sheet.
Parameters:
comparison: DiseaseComparison. The comparison to render.
Throws:
- ProjectError.ObjectNotInitialized When comparison is Nothing.
- ProjectError.ElementNotFound When the workbook has no report sheet.
PrintComparison #
Build the comparison over two tables and render it in one call.
Signature:
Public Function PrintComparison(ByVal firstTable As ListObject, ByVal secondTable As ListObject, _
Optional ByVal firstName As String = "Disease 1", _
Optional ByVal secondName As String = "Disease 2") As DiseaseComparison
Parameters:
firstTable: ListObject. The disease table of the first disease.secondTable: ListObject. The disease table of the second disease.firstName: Optional String. Name shown for the first disease.secondName: Optional String. Name shown for the second disease.
Returns: DiseaseComparison. The comparison that reached the sheet.
Worksheet Helpers
ShowReport #
Make the report visible.
Signature:
Private Sub ShowReport(ByVal targetSheet As Worksheet)
The deploy step hides __compRep. A hidden worksheet refuses the column autofit the render does and refuses to be activated, and the user pressed the button to read the report, so the sheet is shown before the render starts.
ClearReport #
Clear the report sheet and the row marker of the last render.
Signature:
Private Sub ClearReport(ByVal targetSheet As Worksheet)
CheckingOutput formats the sheet on its first render and marks the start row in a hidden name. The name survives a Cells.Clear, and a render that finds it re-applies none of the formatting, so the marker goes with the cells, the way MasterSetupLog.RotateWhenPastCap does it.
ResolveWorksheet #
Find a worksheet of the host workbook by name.
Signature:
Private Function ResolveWorksheet(ByVal lookupName As String) As Worksheet
Used in (2 file(s))
- MasterSetupExports.bas
- TestDiseaseComparisonReport.bas