# ajryan/rpttoxml architecture

> Architecture diagram of the GitHub repository ajryan/rpttoxml, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ajryan/rpttoxml
- Repository: https://github.com/ajryan/rpttoxml

## Overview

RptToXml is a command-line utility that converts Crystal Reports RPT files into XML for inspection and diffs. Its principal workflow accepts a file, wildcard, or recursive-directory request, resolves the matching reports, then invokes the report writer to produce XML to a file or stdout. The writer uses Crystal Reports APIs and reads report-embedded compound-file data; its serialization covers report definitions, database links, formulas, fields, and formatting. The excerpts show only selected writer details, so the graph does not expand unsampled serialization stages.

Main entry points: [`RptToXml/RptDefinitionWriter.cs`](https://github.com/ajryan/rpttoxml/blob/master/RptToXml/RptDefinitionWriter.cs) (Report Writer), [`RptToXml/Program.cs`](https://github.com/ajryan/rpttoxml/blob/master/RptToXml/Program.cs) (Command Handler), [`RptToXml/ConditionFormulas.cs`](https://github.com/ajryan/rpttoxml/blob/master/RptToXml/ConditionFormulas.cs) (Formula Export)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_command["Command Line"]
  node_cli["Command Handler<br/>[Program.cs]"]
  node_input_resolution["Input Resolution<br/>[Program.cs]"]
end

subgraph group_conversion["Report Conversion"]
  node_report_writer["Report Writer"]
  node_formula_export["Formula Export"]
  node_crystal["Crystal Reports API"]
  node_compound_file["Compound File"]
  node_rpt_input["RPT Files"]
end

subgraph group_output["XML Output"]
  node_xml_output["XML Result"]
  node_stdout["Console Output"]
end

node_user(("CLI User"))

node_user -->|"provides arguments"| node_cli
node_cli -->|"resolves inputs"| node_input_resolution
node_input_resolution -->|"selects files"| node_rpt_input
node_cli -->|"creates and invokes"| node_report_writer
node_report_writer -->|"loads report"| node_crystal
node_report_writer -->|"reads report data"| node_compound_file
node_report_writer -->|"writes XML"| node_xml_output
node_report_writer -->|"writes XML"| node_stdout
node_report_writer -->|"uses formula helpers"| node_formula_export

click node_cli "https://github.com/ajryan/rpttoxml/blob/master/RptToXml/Program.cs"
click node_input_resolution "https://github.com/ajryan/rpttoxml/blob/master/RptToXml/Program.cs"
click node_report_writer "https://github.com/ajryan/rpttoxml/blob/master/RptToXml/RptDefinitionWriter.cs"
click node_formula_export "https://github.com/ajryan/rpttoxml/blob/master/RptToXml/ConditionFormulas.cs"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_cli,node_input_resolution,node_user toneBlue
class node_report_writer,node_formula_export,node_crystal,node_compound_file,node_rpt_input toneAmber
class node_xml_output,node_stdout toneMint
```

## Components

### Command Line

- [Command Handler](https://github.com/ajryan/rpttoxml/blob/master/RptToXml/Program.cs): `RptToXml/Program.cs`
- [Input Resolution](https://github.com/ajryan/rpttoxml/blob/master/RptToXml/Program.cs): `RptToXml/Program.cs`

### Report Conversion

- [Report Writer](https://github.com/ajryan/rpttoxml/blob/master/RptToXml/RptDefinitionWriter.cs): `RptToXml/RptDefinitionWriter.cs`
- [Formula Export](https://github.com/ajryan/rpttoxml/blob/master/RptToXml/ConditionFormulas.cs): `RptToXml/ConditionFormulas.cs`
- **Crystal Reports API**
- **Compound File**
- **RPT Files**

### XML Output

- **XML Result**
- **Console Output**

### Other components

- **CLI User**

## Connections

- CLI User → Command Handler: provides arguments (evidence: `README.md`)
- Command Handler → Input Resolution: resolves inputs (evidence: `RptToXml/Program.cs`)
- Input Resolution → RPT Files: selects files (evidence: `RptToXml/Program.cs`)
- Command Handler → Report Writer: creates and invokes (evidence: `RptToXml/Program.cs`)
- Report Writer → Crystal Reports API: loads report (evidence: `RptToXml/RptDefinitionWriter.cs`)
- Report Writer → Compound File: reads report data (evidence: `RptToXml/RptDefinitionWriter.cs`)
- Report Writer → XML Result: writes XML
- Report Writer → Console Output: writes XML
- Report Writer → Formula Export: uses formula helpers (evidence: `RptToXml/ConditionFormulas.cs`)
