Skip to content

Save a rendered report to disk

Persists a rendered report/letter's PDF bytes to a destination file on disk, rendering the report first if necessary.

Field Value
Operation ID OP-REPORTING-SAVE
Trigger Caller invokes Reporting.ReportBase.Save(overwrite)
Inputs DestinationFileName, overwrite flag
Outputs Boolean (whether the destination file exists after the operation)
Primary components Reporting.ReportBase.Save
Entry point SAIF.Services.Printing\Reporting\ReportBase.vb

Steps

  1. Checks whether DestinationFileName already exists on disk.
  2. If it does not exist, or overwrite is requested, and DestinationFileName is non-empty: calls Render a letter or report to ensure m_reportFile is populated, then writes the bytes to DestinationFileName using a FileStream opened with FileMode.Create (truncates/creates).
  3. Returns whether the destination file exists after the operation.

Process flow

flowchart TD
    Start([Save called]) --> Exists{DestinationFileName exists?}
    Exists -->|Yes and not overwrite| EndOk([Return True, file exists])
    Exists -->|No or overwrite| CheckName{DestinationFileName non-empty?}
    CheckName -->|No| EndSkip([Skip write])
    CheckName -->|Yes| Render[Call Render to populate m_reportFile]
    Render --> Write[Write bytes via FileStream FileMode.Create]
    Write --> EndOk

Failure and edge-case behavior

  • If DestinationFileName is empty, no write occurs and the return value reflects whatever existed before the call.*

Sources

  • SAIF.Services.Printing\Reporting\ReportBase.vb