ReportBase¶
ReportBase is the reusable IReport implementation in this library. It stores report state, delegates xPression transport work to clsPrint, applies output-profile conventions, and records failures in ErrorDetail instances instead of re-throwing them from render and distribute operations.
Purpose¶
- Provide a base implementation of the
IReportworkflow. - Centralize report rendering, printing, distribution, saving, and error handling logic.
Context¶
- Namespace:
SAIF.Services.Printing.Reporting - Assembly/package:
SAIF.Services.Printing
Public members¶
| Member | Signature | Purpose |
|---|---|---|
XpressoEnvironments |
Public Enum XpressoEnvironments |
Enumerates xPression environment labels tracked by the class. See XpressoEnvironments. |
New |
Public Sub New() |
Creates an instance using AppGlobal.EnvironmentService. |
New |
Public Sub New(envSvc As EnvironmentServiceBase) |
Creates an instance using a supplied environment service. |
XpressoEnvironment |
Public Property XpressoEnvironment() As XpressoEnvironments |
Gets or sets the xPression environment label stored by the report. |
Errors |
Public ReadOnly Property Errors() As IList(Of ErrorDetail) |
Returns the mutable collection of processing errors. |
xPrint |
Public ReadOnly Property xPrint() As clsPrint |
Lazily creates and returns the clsPrint transport helper. |
ReportPackage |
Public Property ReportPackage() As String |
Gets or sets the xPression package name used for rendering and distribution. |
DestinationFileName |
Public Property DestinationFileName() As String |
Gets or sets the path used by Save. |
OutputProfile |
Public Property OutputProfile() As String |
Gets or sets the current xPression output profile. |
ReportFile |
Public ReadOnly Property ReportFile() As Byte() |
Returns the cached rendered report bytes. |
ReportXml |
Public ReadOnly Property ReportXml() As XDesignXDocument |
Returns the current report XML document. |
Create |
Public Overridable Function Create(Optional overwrite As Boolean = False) As XDesignXDocument |
Clears the error list and returns the current report XML document. |
Render |
Public Function Render(Optional overwrite As Boolean = False) As Boolean |
Renders the report through clsPrint.previewDocument and caches the resulting bytes. |
Print |
Public Function Print(printer As String, Optional overwrite As Boolean = False) As Boolean |
Renders if needed, assigns the printer, and prints the cached bytes. |
Distribute |
Public Function Distribute(Optional overwrite As Boolean = False) As Boolean |
Creates report XML if needed, then distributes the report through clsPrint. |
Save |
Public Function Save(Optional overwrite As Boolean = False) As Boolean |
Renders if needed and writes the cached bytes to DestinationFileName. |
SetDefaultProfile |
Public Sub SetDefaultProfile() |
Sets OutputProfile to the standard PDF profile constant. |
SetDraftProfile |
Public Sub SetDraftProfile() |
Sets OutputProfile to the draft watermark PDF profile constant. |
Behavioral notes¶
Renderenforces BR-003 by resolving a default printer fromclsSecurityPrincipal.Render,Print, andSavefollow BR-004 by reusing cached bytes unless overwrite is requested.SetDefaultProfileandSetDraftProfileenforce BR-005.RenderandDistributecatch exceptions and appendErrorDetailinstances toErrorsinstead of propagating the exception directly.
Constraints and usage notes¶
- Derived classes or callers must ensure that
ReportPackageandReportXmlare populated before render or distribution operations run. Saveonly writes a file whenDestinationFileNameis populated and the file does not already exist, unless overwrite is requested.Createdoes not build XML by itself; it returns the currentm_reportXmlvalue after clearing prior errors.
Sources¶
Services\SAIF.Services.Printing\Reporting\ReportBase.vb