cancel
Showing results for 
Search instead for 
Did you mean: 

How to specify encoding on exporting Crystal report to a text file?

Former Member
0 Kudos

Hello.

According to my tests whenever I export a report document to a text file (ExportFormatType = ExportFormatType.Text), Crystal engine produces UTF-8 file (BOM is EF BB BF). The question is - is there any way to explicitly specify output file encoding (ANSI / UTF-8 / UTF-16)? I am using <SAP Crystal Reports, version for Microsoft Visual Studio> 13.0.10.1385 (i.e. Support Pack 10). C# code example is following:

    {

      TextFormatOptions formatOptions = CrystalDecisions.Shared.ExportOptions.CreateTextFormatOptions();

      formatOptions.CharactersPerInch = 10;

      formatOptions.LinesPerPage = 60;

      DiskFileDestinationOptions destOptions = CrystalDecisions.Shared.ExportOptions.CreateDiskFileDestinationOptions();

      destOptions.DiskFileName = @"c:\test.txt";

      CrystalDecisions.Shared.ExportOptions crystalExportOptions = new CrystalDecisions.Shared.ExportOptions

        {

          ExportFormatType = CrystalDecisions.Shared.ExportFormatType.Text,

          ExportDestinationType = CrystalDecisions.Shared.ExportDestinationType.DiskFile,

          ExportFormatOptions = formatOptions,

          ExportDestinationOptions = destOptions

        };

      CrystalDecisions.CrystalReports.Engine.ReportDocument crystalDocument = new CrystalDecisions.CrystalReports.Engine.ReportDocument();

      crystalDocument.Load(@"c:\test.rpt");

      crystalDocument.Export(crystalExportOptions);

    }

Thanks in advance,

Gleb.

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

Hi Gleb,

Crystal does not have the ability to select the type of encoding when exporting any file types. You will need to use a third party API set to do the encoding outside of Crystal to convert the type.

Don

Answers (0)