1673125 - Special field Page N of M is incorrect when exported to CSV and TXT file formats

SAP Knowledge Base Articles - public

1673125 - Special field Page N of M is incorrect when exported to CSV and TXT file formats


  • Exporting a report from Visual Studio 2010 application to CSV and / or TXT file formats
  • Report contains the special field "Page N of M"
  • Export of one page report is correct showing "Page 1 of 1"
  • Export of multi-page report shows the field as "-1 to 1" on all pages


  • Crystal Reports for Visual Studio 2010
  • Visual Studio 2010

Reproducing the Issue

  1. Create a multi-page report.
  2. Place the special filed "Page N of M" in the footer of the report.
  3. Create a VS .NET application using the following code:
Public Sub New()
        ' This call is required by the designer.
        ' Add any initialization after the InitializeComponent() call.
        Dim crReportDocument As New CrystalDecisions.CrystalReports.Engine.ReportDocument()
        crReportDocument.ExportToDisk(ExportFormatType.Text, "c:\crystal\formulas.txt")
        crReportDocument.ExportToDisk(ExportFormatType.CharacterSeparatedValues, "c:\crystal\formulas.csv")
End Sub


The issue has been identified and tracked under ID ADAPT01608831.


  • Possible work-around: use the Special Filed "Page Number"
  • InProc RAS SDK C++ code that will insert the "Page Number" field at runtime:
CrystalDecisions::ReportAppServer::ClientDoc::ISCDReportClientDocument ^reportClientDocument = thisReport->ReportClientDocument;
  for each (CrystalDecisions::ReportAppServer::ReportDefModel::Section ^boSection in
            reportClientDocument->ReportDefController->ReportDefinition->PageFooterArea->Sections) {
    for each (CrystalDecisions::ReportAppServer::ReportDefModel::ReportObject ^boReportObject in boSection->ReportObjects) {
      CString strTemp = boReportObject->Name;
      if (strTemp.Find(_T("pagenofm")) == 0) { CrystalDecisions::ReportAppServer::DataDefModel::SpecialField ^boSpecialField = gcnew CrystalDecisions::ReportAppServer::DataDefModel::SpecialField();   // Set the type of field 
        boSpecialField->SpecialType = CrystalDecisions::ReportAppServer::DataDefModel::CrSpecialFieldTypeEnum::crSpecialFieldTypePageNumber;
        // Get a new field
        CrystalDecisions::ReportAppServer::ReportDefModel::FieldObject ^boFieldObject =
          gcnew CrystalDecisions::ReportAppServer::ReportDefModel::FieldObject();
        boFieldObject->DataSourceName = boSpecialField->Name;
        boFieldObject->FieldValueType = boSpecialField->Type;
        // Set the location of the new field to where the pageNofM was.
        boFieldObject->Left = boReportObject->Left;
        boFieldObject->Top = boReportObject->Top;
        boFieldObject->Width = boReportObject->Width;
        boFieldObject->Height = boReportObject->Height;
        // Add the new field to the report
        reportClientDocument->ReportDefController->ReportObjectController->Add(boFieldObject, boSection, -1);
        // Remove the pageNofM field



CR2010 2010 CR4VS2010 CR4VS VS2010 NET2010 Crystal Reports for .NET Framework 4.0 crforvs 13 text comma coma separated value , KBA , BI-DEV-NET-SDK , .NET SDK / COM SDK , Bug Filed


SAP Crystal Reports, developer version for Microsoft Visual Studio