Reporting.ReportBase¶
ReportBase is a MustInherit template-method base class implementing IReport that orchestrates the Create → Render → Print/Distribute/Save lifecycle for concrete report/letter types, using an internally owned clsPrint instance to talk to the xPression Design service. Its base Create implementation is a no-op stub (clears errors, returns current XML); concrete subclasses override it to build the actual Reporting.XDesignXDocument tree. The only confirmed concrete subclass in the scanned repository is the test-only MyReport.**
Purpose¶
- Provide consistent render/print/distribute/save orchestration for any concrete letter/report subclass, avoiding duplicated
clsPrintinteraction logic in each subclass. - Collect non-fatal errors from each lifecycle step into an
Errorslist ofReporting.ErrorDetailinstances rather than propagating exceptions to the caller. - Select the correct security platform (Windows vs. Web) when determining the default printer, based on
EnvironmentServiceBase.IsWeb.
Context¶
- Namespace:
SAIF.Services.Printing.Reporting - Assembly/package:
SAIF.Services.Printing(embedded, front-end referenced)
Public members¶
| Member | Signature | Purpose |
|---|---|---|
New() |
Public Sub New() |
Parameterless constructor; delegates to the environment-service-accepting overload using AppGlobal.EnvironmentService.* |
New(envSvc) |
Public Sub New(envSvc As EnvironmentServiceBase) |
Stores the supplied environment service, used later to select the security platform in Render. |
Create(overwrite) |
Overridable Function Create(overwrite As Boolean) As Object |
Base (no-op) implementation clears the error list and returns the current XML; concrete subclasses override this to build the actual document tree. |
Render(overwrite) |
Function Render(overwrite As Boolean) As Boolean |
Builds (via Create) and renders the report to PDF bytes through an internal clsPrint.previewDocument call; see Render a letter or report. |
Print(printer, overwrite) |
Function Print(printer As String, overwrite As Boolean) As Boolean |
Ensures the report is rendered, then prints via clsPrint.printPDF; see Print a letter or report. |
Distribute(overwrite) |
Function Distribute(overwrite As Boolean) As Boolean |
Builds XML (via Create, not Render) and distributes it as plain XML via clsPrint.distributeDocument; see Distribute a letter or report. |
Save(overwrite) |
Function Save(overwrite As Boolean) As Boolean |
Renders (if needed) and writes the resulting bytes to DestinationFileName; see Save a rendered report to disk. |
SetDefaultProfile() |
Sub SetDefaultProfile() |
Sets OutputProfile to "PDF"; see Switch output profile. |
SetDraftProfile() |
Sub SetDraftProfile() |
Sets OutputProfile to "PDF_Draft_Watermark"; see Switch output profile. |
ReportPackage |
Public Property ReportPackage As String |
The xPression package name used when rendering/distributing this report. |
DestinationFileName |
Public Property DestinationFileName As String |
The file path used by Save to persist rendered bytes. |
Errors |
Public ReadOnly Property Errors As List(Of ErrorDetail) |
The collected list of non-fatal errors recorded during Create/Render/Print/Distribute/Save. |
Behavioral notes¶
Rendershort-circuits (returnsTruewithout re-rendering) ifm_reportFileis already populated andoverwriteisFalse.PrintcallsRenderinternally, whileDistributecallsCreatedirectly — a discrepancy that meansDistributemay send un-rendered (not re-rendered-to-PDF) XML content whilePrintalways ensures rendered bytes exist.*Rendersendsm_reportXml.ToXpression(xPression markup) toclsPrint.previewDocument, whileDistributesendsm_reportXml.ToString(plain XML) toclsPrint.distributeDocument— this discrepancy could be intentional (different consumers) or a latent inconsistency; not confirmable from this library's code alone.**Renderdetermines the security platform viaEnvironmentServiceBase.IsWeb, defaulting toclsSecurityPrincipal.Platform.Windowsand switching toPlatform.WebwhenIsWebis true, then callsGetDefaultPrinter().†
Constraints and usage notes¶
Createin the base class is effectively a no-op; concrete subclasses must override it to produce meaningful report content. No confirmed production subclass exists in this repository — only the test-onlyMyReport.**
Note: Statements marked with * were inferred from code structure, naming conventions, or contextual evidence where direct confirmation was not available in source artifacts. Statements marked with ** could not be confirmed; treat as unknown until verified. Statements marked with † were retrieved from dependency library documentation via the Legends CLI RAG service. They describe inherited behavior from the indicated origin library and should be verified if the dependency version changes.
Sources¶
SAIF.Services.Printing\Reporting\ReportBase.vbSAIF.Services.Printing\SAIF.Services.Printing.Tests\MyReport.vb