Click here to Skip to main content
15,891,372 members
Please Sign up or sign in to vote.
1.67/5 (2 votes)
I use Visual Studio 2005 with c# and windows forms. I managed to export crystal reports to pdf in code. But The exported pdf report has added characters. For Example it would display "Mathematics" as "Mathematcs" or
"History" as "Histtory" or "Subject" as "Subjecti"
It basically adds t to every word that has t in lower case. or appends i to it.

I have googled for any posible solution, applied crystal report 2005 hotfix. But the problem continues.

I am stuck. The sample code for export is pasted below

private void btnPrint_Click(object sender, EventArgs e)
{
  string _FileName = DateTime.Now.Month.ToString() + DateTime.Now.Day.ToString() + DateTime.Now.Minute.ToString() + DateTime.Now.Second.ToString() + ".pdf";

  try
  {
    ReportDocument cryRpt = new ReportDocument();
    cryRpt = (ReportDocument)crystalReportViewer1.ReportSource;
    ExportOptions exportOpts = new ExportOptions();
    exportOpts.ExportFormatType = ExportFormatType.PortableDocFormat;
    exportOpts.ExportDestinationType = ExportDestinationType.DiskFile;

    ExportOptions CrExportOptions;
    DiskFileDestinationOptions CrDiskFileDestinationOptions = new DiskFileDestinationOptions();
    PdfRtfWordFormatOptions CrFormatTypeOptions = new PdfRtfWordFormatOptions();
                
    CrDiskFileDestinationOptions.DiskFileName = ConfigurationManager.AppSettings.Get("PRINT_TEMP") + _FileName;
    CrExportOptions = cryRpt.ExportOptions;
    {
      CrExportOptions.ExportDestinationType = ExportDestinationType.DiskFile;
      CrExportOptions.ExportFormatType = ExportFormatType.PortableDocFormat;
      CrExportOptions.DestinationOptions = CrDiskFileDestinationOptions;
      CrExportOptions.FormatOptions = CrFormatTypeOptions;
    }
    cryRpt.Export();
    System.Diagnostics.Process.Start(ConfigurationManager.AppSettings.Get("PRINT_TEMP") + _FileName);
  }
  catch(Exception Ex)
  {
    string msg = Ex.Message;
    MessageBox.Show("You Must Have a report viewable in the Report panel To print");
  }
}
Posted
Updated 13-Jul-17 12:00pm
v3

I guess you have used unusual fonts for text fields, formulas, etc objects in crystal reports. So just verify the fonts in your reports. I have the same issue once upon a time & I verified the fonts for the objects & it was Calibri or something I think. So you need to install the font in production server or change the fonts for you objects in crystal reports with regular fonts like Arial, Tahoma, Verdana.
 
Share this answer
 
Comments
jopima 9-Nov-10 11:57am    
Thanks for your response, Actually you are right. i am using calibri font. That behavior thou happened on my development machine before i took the system into production. when i test run it in production i was surprised that the reports come out without the strange characters added. that was my biggest panic point. let me follow that line of thought and see how far i go to fix it permanently. i don't intend to drop using calibri font.
IndifferentDisdain 12-Apr-13 14:42pm    
I noticed the same issues; I think in my case it was due to having CR2008 on my dev machine, and just the runtime on my test server, so maybe installing CR2008 resolves it? Not sure, kind of confusing. I was able to change fonts, so I just went with that:)
H.Brydon 12-Apr-13 14:36pm    
+5 from me to compensate for unwarranted downvote.
IndifferentDisdain 12-Apr-13 14:40pm    
Much appreciated!
 
Share this answer
 
Comments
IndifferentDisdain 12-Apr-13 10:39am    
I'm curious why this was downvoted; anyone care to share? I literally went through this at work about a week ago.
H.Brydon 12-Apr-13 14:35pm    
Yeah, doesn't make sense. +5 from me to compensate...
IndifferentDisdain 12-Apr-13 14:44pm    
Commented on the wrong comment of yours, so thanks again!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900