Skip to content

Commit 3b407ef

Browse files
committed
Rename XmlExtractor/RptToXml to XmlExtractor/Source, rewrite README
- Renamed inner folder from RptToXml/ to Source/ for clarity - Rewrote XmlExtractor README with complete documentation: what it extracts, prerequisites, building, usage, output structure - Updated main README and .gitignore with new paths - MIT license and attribution preserved
1 parent d86bba8 commit 3b407ef

12 files changed

Lines changed: 110 additions & 30 deletions

File tree

CrystalReport/.gitignore

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,13 @@ _package/
4040
XML_Output/
4141

4242
# XmlExtractor build artifacts and sample .rpt files
43-
XmlExtractor/RptToXml/bin/
44-
XmlExtractor/RptToXml/obj/
45-
XmlExtractor/RptToXml/packages/
46-
XmlExtractor/RptToXml/Samples/
43+
XmlExtractor/Source/bin/
44+
XmlExtractor/Source/obj/
45+
XmlExtractor/Source/packages/
46+
XmlExtractor/Source/Samples/
4747
XmlExtractor/.gitignore
48-
XmlExtractor/RptToXml/.editorconfig
49-
XmlExtractor/RptToXml/RptToXml.sln.DotSettings
48+
XmlExtractor/Source/.editorconfig
49+
XmlExtractor/Source/RptToXml.sln.DotSettings
5050

5151
# AI assistants
5252
.claude/

CrystalReport/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ CrystalReport/ <- Solution root
144144

145145
1. **SAP Crystal Reports runtime** (64-bit) from [SAP](https://www.sap.com/cmp/td/sap-crystal-reports-visual-studio-trial.html)
146146
2. **Build the main solution**: Open `CrystalReport.slnx` in Visual Studio, build in Debug
147-
3. **Build XmlExtractor**: Open `XmlExtractor\RptToXml\RptToXml.sln` in Visual Studio, build in Debug
147+
3. **Build XmlExtractor**: Open `XmlExtractor\Source\RptToXml.sln` in Visual Studio, build in Debug
148148
4. Copy your `.rpt` files into `_source\_rpt_files_main\`
149149
5. Create `_source\config\datasources.yaml` (see [Config](#config-file) section)
150150

@@ -209,7 +209,7 @@ All commands run from the `CrystalReport\` solution root.
209209

210210
### Step 1 -- XML Extraction
211211
```bat
212-
XmlExtractor\RptToXml\bin\Debug\RptToXml.exe ^
212+
XmlExtractor\Source\bin\Debug\RptToXml.exe ^
213213
"_source\_rpt_files_main\ServiceContract.rpt" ^
214214
"Output\_cr_xml\ServiceContract.xml"
215215
```
Lines changed: 102 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,120 @@
1-
# RptToXml
1+
# Crystal Report XML Extractor
22

3-
Dumps a Crystal Reports RPT file to XML. Useful for diffs.
3+
Extracts the complete definition of Crystal Report (`.rpt`) files into structured XML, including report layout, formatting, data sources, SQL commands, formulas, parameters, and saved data.
44

5-
Binary releases available on the [Releases](https://github.com/ajryan/RptToXml/releases) page.
5+
This is Step 1 of the Crystal Report to Power BI migration pipeline. The extracted XML serves as the source of truth for all downstream conversion steps.
66

7-
Ported to C# from the [original VB project](http://code.google.com/p/rpttoxml/)
7+
Based on [RptToXml](https://github.com/ajryan/RptToXml) by Aidan Ryan (MIT License).
88

9-
## Running
9+
---
1010

11-
Download the latest [release](https://github.com/ajryan/RptToXml/releases).
11+
## What It Extracts
1212

13-
RptToXml references Crystal Reports assemblies. The easiest way to get them onto a development machine is to install the Crystal Reports Runtime from an MSI downloaded from [this page](https://www.sap.com/cmp/td/sap-crystal-reports-visual-studio-trial.html).
13+
| Data | Description |
14+
|---|---|
15+
| **Report Layout** | Sections (header, detail, footer), objects with exact positions (x, y, width, height) |
16+
| **Formatting** | Font (name, size, bold, italic, underline), text color, alignment, borders |
17+
| **Data Sources** | Database connections (server, database), SQL command text, table joins |
18+
| **Fields** | Database fields with type and length, formula field definitions |
19+
| **Formulas** | Full Crystal formula text (supports multilingual switch statements) |
20+
| **Parameters** | Report parameters with types and default values |
21+
| **Saved Data** | Cached report data exported as tab-separated values |
22+
| **Visual Elements** | Lines, boxes, images, subreports with positions and styles |
23+
| **Suppress Conditions** | Visibility rules and conditional formatting formulas |
1424

15-
Install the SAP frameworks (probably need 32-bit and 64-bit):
25+
---
1626

17-
- SAP Crystal Reports for Visual Studio (SP##) runtime engine for .NET framework MSI (32-bit)
18-
- SAP Crystal Reports for Visual Studio (SP##) runtime engine for .NET framework MSI (64-bit)
27+
## Prerequisites
1928

20-
Run the executable from the command line with
29+
**SAP Crystal Reports Runtime** (64-bit) must be installed:
2130

22-
```sh
23-
# process a single file
24-
RptToXml.exe path/to/report_name.rpt path/to/output.xml
31+
1. Go to https://origin.softwaredownloads.sap.com/public/site/index.html
32+
2. Search for: "SAP Crystal Reports, developer version"
33+
3. Download: **CR for Visual Studio SP39 CR Runtime 64-bit MSI** (117.1 MB)
34+
4. Run the MSI installer
2535

26-
# process a directory of reports
27-
cd path/to/reports
28-
RptToXml.exe -r
36+
---
37+
38+
## Building
39+
40+
Open `Source\RptToXml.sln` in Visual Studio and build (Debug or Release).
41+
42+
The executable is at `Source\bin\Debug\RptToXml.exe`.
43+
44+
---
45+
46+
## Usage
47+
48+
**Single file:**
49+
```bat
50+
RptToXml.exe "path\to\report.rpt" "path\to\output.xml"
2951
```
3052

31-
## Building From Source
53+
**All files in a folder:**
54+
```bat
55+
cd path\to\rpt_folder
56+
RptToXml.exe -r --ignore-errors
57+
```
3258

33-
The solution will build with VS2012 or higher. Express editions have not been tested but should work.
59+
**Options:**
60+
61+
| Flag | Description |
62+
|---|---|
63+
| `-r` | Recursively process all .rpt files in the current directory |
64+
| `--ignore-errors` | Continue to the next file if an error occurs |
65+
| `--stdout` | Write XML to console instead of file |
66+
67+
---
68+
69+
## Output Structure
70+
71+
```xml
72+
<Report Name="" FileName="report.rpt" HasSavedData="True">
73+
<Summaryinfo ReportTitle="..." />
74+
<PrintOptions PageContentWidth="..." PageContentHeight="..." PaperOrientation="..." />
75+
<Database>
76+
<TableLinks> ... </TableLinks>
77+
<Tables>
78+
<Table Alias="Header" ClassName="CrystalReports.CommandTable">
79+
<ConnectionInfo QE_ServerDescription="." QE_DatabaseName="..." />
80+
<Command>SELECT ... FROM ...</Command>
81+
<Fields>
82+
<Field Name="..." Type="..." Length="..." />
83+
</Fields>
84+
</Table>
85+
</Tables>
86+
</Database>
87+
<DataDefinition>
88+
<FormulaFieldDefinition Name="Title" ...>
89+
switch({@X_Language} = 'EN', 'Service Contract', True, 'Default')
90+
</FormulaFieldDefinition>
91+
<ParameterFieldDefinition Name="DocKey" ValueType="NumberField" />
92+
</DataDefinition>
93+
<ReportDefinition>
94+
<Areas>
95+
<Area Kind="PageHeader">
96+
<Section Height="2705" Kind="PageHeader" Name="PageHeaderSection1">
97+
<ReportObjects>
98+
<FieldObject Name="Title1" DataSource="{@Title}" Top="191" Left="0" Width="6313" Height="529">
99+
<Font Name="Arial" Size="16" Bold="False" />
100+
<ObjectFormat HorizontalAlignment="DefaultAlign" EnableSuppress="False" />
101+
</FieldObject>
102+
</ReportObjects>
103+
</Section>
104+
</Area>
105+
</Areas>
106+
</ReportDefinition>
107+
<SavedData>
108+
<Row Index="0"><Col Index="0">Service Contract</Col></Row>
109+
<Row Index="1"><Col Index="0">Customer Name</Col><Col Index="1">:</Col><Col Index="2">Microchips</Col></Row>
110+
</SavedData>
111+
</Report>
112+
```
34113

35-
Install the SAP pacakge for Visual Studio:
114+
---
36115

37-
- SAP Crystal Reports for Visual Studio (SP##) installation package for Microsoft Visual Studio IDE (VS 20## and above or below)
116+
## License
38117

118+
MIT License. See [LICENSE](LICENSE) for details.
39119

40-
Find the executable `RptToXml.exe` in ```RptToXml/bin/<where did you build to?>``` after building the solution in Visual Studio.
120+
Original work by [Aidan Ryan](https://github.com/ajryan/RptToXml). Modified for the Crystal Report to Power BI migration pipeline with saved data extraction and security hardening.

CrystalReport/XmlExtractor/RptToXml/ConditionFormulas.cs renamed to CrystalReport/XmlExtractor/Source/ConditionFormulas.cs

File renamed without changes.
File renamed without changes.
File renamed without changes.

CrystalReport/XmlExtractor/RptToXml/Properties/AssemblyInfo.cs renamed to CrystalReport/XmlExtractor/Source/Properties/AssemblyInfo.cs

File renamed without changes.

CrystalReport/XmlExtractor/RptToXml/RptDefinitionWriter.cs renamed to CrystalReport/XmlExtractor/Source/RptDefinitionWriter.cs

File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)