public static void FCVRtoPDF(CrystalDecisions.CrystalReports.Engine.ReportDocument rptObj, string fileName, string fileNameErr)
        {
            if (rptObj != null)
            {
                try
                {
                    //check if alternate location exists, else create
                    System.IO.DirectoryInfo location = System.IO.Directory.GetParent(fileName);
                    if (!location.Exists)
                    {
                        try { location.Create(); }
                        catch { }
                    }
                    rptObj.ExportToDisk(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, string.Format("{0}", fileName));
                }
                catch (Exception e)
                {
                    //check if alternate location exists, else create
                    System.IO.DirectoryInfo altlocation = System.IO.Directory.GetParent(fileNameErr);
                    if (!altlocation.Exists)
                    {
                        try { altlocation.Create(); }
                        catch { }
                    }

                    try { rptObj.ExportToDisk(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, string.Format("{0}", fileNameErr)); }
                    catch { }
                }
            }
        }
 public bool Export(CrystalDecisions.CrystalReports.Engine.ReportClass report, string path, TypeBC type)
 {
     if (report == null)
         return false;
     switch (type)
     {
         case TypeBC.WordForWindows:
             {
                 int index=path.LastIndexOf('.');
                 if (index > 0)
                 {
                     if (path.Substring(index + 1).ToLower().Equals("doc"))
                     {
                         report.ExportToDisk(CrystalDecisions.Shared.ExportFormatType.WordForWindows, path);
                     }
                     else if(index==path.Length-1)
                         report.ExportToDisk(CrystalDecisions.Shared.ExportFormatType.WordForWindows, path+"doc");
                     else
                         report.ExportToDisk(CrystalDecisions.Shared.ExportFormatType.WordForWindows, path + ".doc");
                 }
                 else
                     report.ExportToDisk(CrystalDecisions.Shared.ExportFormatType.WordForWindows, path + ".doc");
                 break;
             }
         case TypeBC.Excel:
             {
                 int index = path.LastIndexOf('.');
                 if (index > 0)
                 {
                     if (path.Substring(index + 1).ToLower().Equals("xls"))
                     {
                         report.ExportToDisk(CrystalDecisions.Shared.ExportFormatType.Excel, path);
                     }
                     else if (index == path.Length - 1)
                         report.ExportToDisk(CrystalDecisions.Shared.ExportFormatType.Excel, path + "xls");
                     else
                         report.ExportToDisk(CrystalDecisions.Shared.ExportFormatType.Excel, path + ".xls");
                 }
                 else
                     report.ExportToDisk(CrystalDecisions.Shared.ExportFormatType.Excel, path + ".xls");
                 break;
             }
         case TypeBC.PortableDocFormat:
             {
                 int index = path.LastIndexOf('.');
                 if (index > 0)
                 {
                     if (path.Substring(index + 1).ToLower().Equals("pdf"))
                     {
                         report.ExportToDisk(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, path);
                     }
                     else if (index == path.Length - 1)
                         report.ExportToDisk(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, path + "pdf");
                     else
                         report.ExportToDisk(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, path + ".pdf");
                 }
                 else
                     report.ExportToDisk(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, path + ".pdf");
                 break;
             }
     }
     return true;
 }