();
99 | var parameters = rpt.DataDefinition.ParameterFields;
100 | foreach (ParameterFieldDefinition param in parameters)
101 | {
102 | paramtrs.Add($"Parameter {param.ReportName}.{param.Name}");
103 | }
104 | return paramtrs;
105 | }
106 |
107 | public static void WritePrintOptions(this JsonWriter jw, PrintOptions printOptions)
108 | {
109 | jw.WritePropertyName("PrintOptions");
110 | jw.WriteStartObject();
111 | jw.WriteProperty("NoPrinter", printOptions.NoPrinter);
112 | jw.WriteProperty("PrinterName", printOptions.PrinterName);
113 | jw.WriteProperty("SavedPrinterName", printOptions.SavedPrinterName);
114 | jw.WriteProperty("PrinterDuplex", printOptions.PrinterDuplex.ToString());
115 | jw.WriteProperty("PaperOrientation", printOptions.PaperOrientation.ToString());
116 | jw.WriteProperty("PaperSize", printOptions.PaperSize.ToString());
117 | jw.WriteProperty("PaperSource", printOptions.PaperSource.ToString());
118 | jw.WriteProperty("DissociatePageSizeAndPrinterPaperSize", printOptions.DissociatePageSizeAndPrinterPaperSize);
119 | jw.WriteProperty("PageContentHeight", $"{printOptions.PageContentHeight} twips ({printOptions.PageContentHeight / 1440.0:N3} inches)");
120 | jw.WriteProperty("PageContentWidth", $"{printOptions.PageContentWidth} twips ({printOptions.PageContentWidth / 1440.0:N3} inches)");
121 |
122 | jw.WritePropertyName("PageMargins");
123 | jw.WriteStartObject();
124 | jw.WriteProperty("topMargin", $"{printOptions.PageMargins.topMargin} twips ({printOptions.PageMargins.topMargin / 1440.0:N3} inches)");
125 | jw.WriteProperty("leftMargin", $"{printOptions.PageMargins.leftMargin} twips ({printOptions.PageMargins.leftMargin / 1440.0:N3} inches)");
126 | jw.WriteProperty("rightMargin", $"{printOptions.PageMargins.rightMargin} twips ({printOptions.PageMargins.rightMargin / 1440.0:N3} inches)");
127 | jw.WriteProperty("bottomMargin", $"{printOptions.PageMargins.bottomMargin} twips ({printOptions.PageMargins.bottomMargin / 1440.0:N3} inches)");
128 |
129 | jw.WriteEndObject();
130 | }
131 | }
132 | }
--------------------------------------------------------------------------------
/CRSerializer/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.InteropServices;
3 |
4 | // General Information about an assembly is controlled through the following
5 | // set of attributes. Change these attribute values to modify the information
6 | // associated with an assembly.
7 | [assembly: AssemblyTitle("CRSerializer")]
8 | [assembly: AssemblyDescription("")]
9 | [assembly: AssemblyConfiguration("")]
10 | [assembly: AssemblyCompany("")]
11 | [assembly: AssemblyProduct("CRSerializer")]
12 | [assembly: AssemblyCopyright("Copyright © 2020")]
13 | [assembly: AssemblyTrademark("")]
14 | [assembly: AssemblyCulture("")]
15 |
16 | // Setting ComVisible to false makes the types in this assembly not visible
17 | // to COM components. If you need to access a type in this assembly from
18 | // COM, set the ComVisible attribute to true on that type.
19 | [assembly: ComVisible(false)]
20 |
21 | // The following GUID is for the ID of the typelib if this project is exposed to COM
22 | [assembly: Guid("612827ce-316d-40e7-9082-cb0a7b9be047")]
23 |
24 | // Version information for an assembly consists of the following four values:
25 | //
26 | // Major Version
27 | // Minor Version
28 | // Build Number
29 | // Revision
30 | //
31 | // You can specify all the values or you can default the Build and Revision Numbers
32 | // by using the '*' as shown below:
33 | // [assembly: AssemblyVersion("1.0.*")]
34 | [assembly: AssemblyVersion("0.0.0.0")]
35 | [assembly: AssemblyFileVersion("0.0.0.0")]
36 | [assembly: AssemblyInformationalVersion("0.1.0.{revnum}_{c:ymd-}_{chash:7}{!:+}")]
--------------------------------------------------------------------------------
/CRSerializer/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 | CRDiff
3 | CRDiff is a program that serializes the binary Crystal reports .rpt files to human readable .json files, and works in conjunction with your favorite text diff tool. If your tool is configurable to use file transforms/converters, it works even better.
4 | Installation
5 | The published location is \\aus2-odx-dfs01.pdsenergy.local\devTools\CRDiff
6 | Copy the contents to the local folder of your choice (referred to below as <CRDiff Path>) - Having that folder in your PATH environment variable can be helpful.
7 | You may get a message "Are you sure you want to run this software?"
8 |
9 | - Uncheck "Always ask before opening this file" and
10 | - press "Run"
11 |
12 | If when CRDiff.exe is run with no parameters, you don't see a valid CR Version displayed, you may need to install the Crystal Reports Runtime, available in the Crystal Reports Runtime folder.
13 | Usage:
14 |
15 | - CRDiff.exe DiffAppPath.exe
16 |
17 | - Save your diff tool's path in CRDiff's config file.
18 |
19 |
20 | - CRDiff.exe ReportFilename.rpt
21 |
22 | - Serialize the report to a json file of the same name and location but with .json extension.
23 |
24 |
25 | - CRDiff.exe ReportFilename.rpt, ReportFilename2.rpt
26 |
27 | - Serialize the two reports to json and pass the json files to your diff tool. Once you close your text diff tool, CRDiff will delete the json files (if they hadn't already existed). If you haven't set a text diff path above, you will be prompted for one.
28 |
29 |
30 | - CRDiff.exe DiffAppPath.exe ReportFilename1.rpt ReportFilename2.rpt
31 |
32 | - Same as above, but DiffAppPath.exe is used instead of what is saved in config.
33 |
34 |
35 | - CRDiff.exe ReportFilename.rpt, TempFilename(.json)
36 |
37 | - Serialize ReportFilename.rpt to TempFilename (provided by your configurable text diff tool, which is responsible for cleaning up after itself).
38 |
39 |
40 | - Parameters:
41 |
42 | - DiffAppPath - path to external differencing application .exe file that can compare two text files
43 | - ReportFilename1 - path to first .rpt file to be serialized to json, or it can be an existing report.json file
44 | - ReportFilename2 - path to second .rpt file to be serialized to json (or existing .json file) and compared with first file
45 | - TempFilename - path to a temporary file that will likely be deleted after use.
46 |
47 |
48 |
49 | Configuration
50 | CompareIt!
51 | Open CompareIt!, open Tools/Options, and select Converters. Press "Add", and specify Name: "Crystal Reports", Mask: "*.rpt", Command: "<CRDiff path>CRDiff.exe", Arguments: "{$Source_File} {$Converted_File}"
52 | Beyond Compare
53 | In Tools, File Formats..., press "+" and select Text Format. In the General tab, specify Mask: "*.rpt". In the Conversion tab, specify "External program (Unicode filenames)", Loading: "<CRDiff path>CRDiff.exe %s %t", check Disable editing, then Save.
54 | TortoiseGit
55 | In Settings, Diff Viewer, click Advanced, Add..., and specify Extension: ".rpt", External Program: "<CRDiff path>CRDiff.exe <path to your text compare tool> %base %mine"
56 | Others
57 | TBA
58 | Features
59 |
60 | - Checks file extension, and if it is not .rpt, file passes directly to text diff tool.
61 | - Serializes many of the report details we want to be able to compare into a text file, like
62 |
63 | - Command query
64 | - element dimensions and settings
65 | - subreports
66 |
67 |
68 | - Save serialized files and pass to a text diff tool
69 | - Clean-up (delete) temp files after text diff tool is closed.
70 |
71 | Still to Implement
72 |
73 | - Need to output
74 |
75 | - element suppression formulas (and other formulas for elements)
76 | - sub-textbox formatting (ie font changes, coloring, tab settings, etc)
77 | - "Lock Position"
78 | - "change number sign"
79 | - Page Setup (ie Printer, margins)
80 | - "Keep Data" setting
81 |
82 |
83 |
84 |
--------------------------------------------------------------------------------