cancel
Showing results for 
Search instead for 
Did you mean: 

How to view XML file exported by Crystal report

Former Member
0 Kudos

Our system have many reports that we are using Crystal report to export to pdf.

Now our new requirement is to sign our exported documents, and store them for years, so file size is a problem.

So we search and found that Crystal report support output document in Xml:

<code>lrep.ExportToDisk(CrystalDecisions.Shared.ExportFormatType.Xml,"outputXml.xml");

But the problem is that we can't search for a way to view that outputXml.xml with layout as our old file outputPdf.pdf.

We can only read that xml file as normal text file with tags and values. No layout, no line, no table, no text size, no bold, italic,.......

Could anyone help us with how to view, and convert this outputXml to pdf, like others output from Crystal report (pdf, word, excel)?

Thanks for any help.

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

Hi Bach,

No option to convert XML into a report. All exporting does to those types of files is export the data into flat file types. PDF, Word, RTF, etc, can do formatting so you see the same in the viewers.

Not sure what you are signing the reports with, a real signature or ????

If it's only a user name then add the info to the Summary Info, you can update it at runtime.

You can export to RPTR format, it's read only and can only be opened in an application. File size would be smaller but not sure about the signature part, not clear.

// This works do not alter
// this gets the report name and sets the export name to be the same less the extension
string outputFileName = "";
string MyRptName = rpt.FileName.ToString();
outputFileName = MyRptName.Substring(9, rpt.FileName.Length - 9);
outputFileName = outputFileName.Substring(0, (outputFileName.Length - 3)) + "rptr";

try
{
if (File.Exists(outputFileName))
{
File.Delete(outputFileName);
}

CrystalDecisions.ReportAppServer.ReportDefModel.CrReportExportFormatEnum RasRPTRExpOpts = (CrReportExportFormatEnum.crReportExportFormatRPTR);

CrystalDecisions.ReportAppServer.ReportDefModel.ExportOptions exportOpts1 = new CrystalDecisions.ReportAppServer.ReportDefModel.ExportOptions();
exportOpts1.ExportFormatType = CrReportExportFormatEnum.crReportExportFormatRPTR;
exportOpts1.FormatOptions = RasRPTRExpOpts;

// And Export
rptClientDoc.PrintOutputController.ExportEx(exportOpts1).Save(outputFileName, true);
MessageBox.Show("Export to Report RPTR Completed", "", MessageBoxButtons.OK, MessageBoxIcon.Information);

}
catch (Exception ex)
{
btnSQLStatement.Text = "ERROR: " + ex.Message;
return;
}

Don

Former Member
0 Kudos

Thank you for your reply.

We need to apply digital signature to exported document and then store those signed files, but pdf format is too larger.

And if Crystal report don't have an automatic way to change from CrystalOutputXml to CrystalOutputPdf (without the third .rpt file for each CrystalOutputXml) then IMO the better way is to export data directly to dataOutputXml instead of processing data and .rpt report layout and then export to a CrystalOutputXml.

Not sure about the RPTR format, I searched but result show that it's just the read only version of .rpt ?

Tried your code to export to RPTR, but got error so can't get a rptr file to check. (ReportDefModel not exists in namespace CrystalDecisions.ReportAppServer)

0 Kudos

Add these assemblies:

using CrystalDecisions.CrystalReports.Engine;
using CrystalDecisions.Shared;
using CrystalDecisions.ReportAppServer;
using CrystalDecisions.ReportAppServer.ClientDoc;
using CrystalDecisions.ReportAppServer.Controllers;
using CrystalDecisions.ReportAppServer.ReportDefModel;
using CrystalDecisions.ReportAppServer.CommonControls;
using CrystalDecisions.ReportAppServer.CommLayer;
using CrystalDecisions.ReportAppServer.CommonObjectModel;
using CrystalDecisions.ReportAppServer.ObjectFactory;
using CrystalDecisions.ReportAppServer.Prompting;
using CrystalDecisions.ReportAppServer.DataSetConversion;
using CrystalDecisions.ReportAppServer.DataDefModel;
using CrystalDecisions.ReportSource;
using CrystalDecisions.Windows.Forms;
using CrystalDecisions.ReportAppServer.XmlSerialize;

Answers (0)