Skip to content

Commit a825462

Browse files
committed
chore: added CrystalReportsConverter app
- added sample application demonstrating how to convert from Crystal Reports programmatically. refs: #4330
1 parent b9294a6 commit a825462

File tree

6 files changed

+195
-0
lines changed

6 files changed

+195
-0
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<configuration>
3+
<startup>
4+
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" />
5+
</startup>
6+
<runtime>
7+
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
8+
</assemblyBinding>
9+
</runtime>
10+
</configuration>
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
using System;
2+
using Telerik.Reporting.Interfaces;
3+
4+
namespace CrystalReportsConverter
5+
{
6+
class ConsoleLogger : Telerik.Reporting.Interfaces.ILog
7+
{
8+
public void LogError(string message)
9+
{
10+
Console.WriteLine($"Error: {message}");
11+
}
12+
13+
public void LogWarning(string message)
14+
{
15+
Console.WriteLine($"Warning: {message}");
16+
}
17+
18+
public void LogInfo(string message)
19+
{
20+
Console.WriteLine(message);
21+
}
22+
23+
void ILog.Log(string message)
24+
{
25+
this.LogInfo(message);
26+
}
27+
}
28+
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
namespace CrystalReportsConverter
2+
{
3+
using System;
4+
using System.IO;
5+
using Telerik.Reporting.Interfaces;
6+
7+
class Converter
8+
{
9+
public void Convert(string directory)
10+
{
11+
var logger = new ConsoleLogger();
12+
logger.LogInfo($"Conversion started in folder {directory}.");
13+
var files = Directory.GetFiles(directory, "*.rpt");
14+
try
15+
{
16+
for (int i = 0; i < files.Length; i++)
17+
{
18+
logger.LogInfo($"Converting file {i + 1}/{files.Length}: {Path.GetFileName(files[i])}...");
19+
Convert(files[i], logger);
20+
}
21+
}
22+
catch (Exception ex)
23+
{
24+
logger.LogError(ex.Message);
25+
}
26+
finally
27+
{
28+
logger.LogInfo($"Conversion of {files.Length} Crystal Report files completed.");
29+
}
30+
}
31+
32+
void Convert(string crystalReportFilePath, ILog logger)
33+
{
34+
var crConverter = new Telerik.ReportConverter.CrystalReports.CrystalReportsConverter();
35+
var trReport = crConverter.Convert(crystalReportFilePath, logger);
36+
37+
var telerikReportFilePath = Path.ChangeExtension(crystalReportFilePath, "trdx");
38+
new Telerik.Reporting.XmlSerialization.ReportXmlSerializer()
39+
.Serialize(telerikReportFilePath, trReport);
40+
}
41+
}
42+
}
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
4+
<PropertyGroup>
5+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
6+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
7+
<ProjectGuid>{CF679780-B1E8-4F89-B210-5E092238DAB3}</ProjectGuid>
8+
<OutputType>Exe</OutputType>
9+
<RootNamespace>CrystalReportsConverter</RootNamespace>
10+
<AssemblyName>CrystalReportsConverter</AssemblyName>
11+
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
12+
<FileAlignment>512</FileAlignment>
13+
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
14+
<Deterministic>true</Deterministic>
15+
<NuGetPackageImportStamp>
16+
</NuGetPackageImportStamp>
17+
</PropertyGroup>
18+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
19+
<PlatformTarget>x64</PlatformTarget>
20+
<DebugSymbols>true</DebugSymbols>
21+
<DebugType>full</DebugType>
22+
<Optimize>false</Optimize>
23+
<OutputPath>bin\Debug\</OutputPath>
24+
<DefineConstants>DEBUG;TRACE</DefineConstants>
25+
<ErrorReport>prompt</ErrorReport>
26+
<WarningLevel>4</WarningLevel>
27+
</PropertyGroup>
28+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
29+
<PlatformTarget>AnyCPU</PlatformTarget>
30+
<DebugType>pdbonly</DebugType>
31+
<Optimize>true</Optimize>
32+
<OutputPath>bin\Release\</OutputPath>
33+
<DefineConstants>TRACE</DefineConstants>
34+
<ErrorReport>prompt</ErrorReport>
35+
<WarningLevel>4</WarningLevel>
36+
</PropertyGroup>
37+
<ItemGroup>
38+
<Reference Include="System" />
39+
<Reference Include="System.Core" />
40+
<Reference Include="System.Xml.Linq" />
41+
<Reference Include="System.Data.DataSetExtensions" />
42+
<Reference Include="Microsoft.CSharp" />
43+
<Reference Include="System.Data" />
44+
<Reference Include="System.Net.Http" />
45+
<Reference Include="System.Xml" />
46+
<Reference Include="Telerik.ReportConverter.CrystalReports, Version=19.0.25.211, Culture=neutral, PublicKeyToken=a9d7983dfcc261be, processorArchitecture=MSIL">
47+
<SpecificVersion>False</SpecificVersion>
48+
<HintPath>ext\Telerik.ReportConverter.CrystalReports.dll</HintPath>
49+
</Reference>
50+
<Reference Include="Telerik.Reporting, Version=19.0.25.211, Culture=neutral, PublicKeyToken=a9d7983dfcc261be, processorArchitecture=MSIL">
51+
<SpecificVersion>False</SpecificVersion>
52+
<HintPath>ext\Telerik.Reporting.dll</HintPath>
53+
</Reference>
54+
</ItemGroup>
55+
<ItemGroup>
56+
<Compile Include="ConsoleLogger.cs" />
57+
<Compile Include="Converter.cs" />
58+
<Compile Include="Program.cs" />
59+
<Compile Include="Properties\AssemblyInfo.cs" />
60+
</ItemGroup>
61+
<ItemGroup>
62+
<None Include="App.config" />
63+
</ItemGroup>
64+
<ItemGroup>
65+
<Folder Include="ext\" />
66+
</ItemGroup>
67+
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
68+
</Project>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
namespace CrystalReportsConverter
2+
{
3+
using System;
4+
5+
class Program
6+
{
7+
static void Main(string[] args)
8+
{
9+
const string crystalReportsFolder = @"c:\crystal-reports";
10+
new CrystalReportsConverter.Converter()
11+
.Convert(crystalReportsFolder);
12+
}
13+
}
14+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
using System.Reflection;
2+
using System.Runtime.CompilerServices;
3+
using System.Runtime.InteropServices;
4+
5+
// General Information about an assembly is controlled through the following
6+
// set of attributes. Change these attribute values to modify the information
7+
// associated with an assembly.
8+
[assembly: AssemblyTitle("CrystalReportsConverter")]
9+
[assembly: AssemblyDescription("")]
10+
[assembly: AssemblyConfiguration("")]
11+
[assembly: AssemblyCompany("Progress")]
12+
[assembly: AssemblyProduct("CrystalReportsConverter")]
13+
[assembly: AssemblyCopyright("Copyright © Progress 2025")]
14+
[assembly: AssemblyTrademark("")]
15+
[assembly: AssemblyCulture("")]
16+
17+
// Setting ComVisible to false makes the types in this assembly not visible
18+
// to COM components. If you need to access a type in this assembly from
19+
// COM, set the ComVisible attribute to true on that type.
20+
[assembly: ComVisible(false)]
21+
22+
// The following GUID is for the ID of the typelib if this project is exposed to COM
23+
[assembly: Guid("cf679780-b1e8-4f89-b210-5e092238dab3")]
24+
25+
// Version information for an assembly consists of the following four values:
26+
//
27+
// Major Version
28+
// Minor Version
29+
// Build Number
30+
// Revision
31+
//
32+
[assembly: AssemblyVersion("1.0.0.0")]
33+
[assembly: AssemblyFileVersion("1.0.0.0")]

0 commit comments

Comments
 (0)