Skip to Content
avatar image
Former Member

How to view XML file exported by Crystal report

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:


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.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    Aug 15, 2017 at 07:42 PM

    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";

    if (File.Exists(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;


    Add comment
    10|10000 characters needed characters exceeded

    • 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;