导出为pdf时,Crystal Report会显示奇怪的字符 [英] Crystal Report Displays Strange Characters when Exported to pdf

查看:98
本文介绍了导出为pdf时,Crystal Report会显示奇怪的字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用带有c#和windows窗体的Visual Studio 2005。我设法在代码中将水晶报告导出为pdf。但导出的pdf报告添加了字符。例如,它会将数学显示为数学

历史记录为历史记录主题 as Subjecti

它基本上将t添加到t为小写的每个单词。或者我把它添加到它。



我已经搜索了任何可行的解决方案,应用了crystal report 2005修补程序。但问题还在继续。



我被困住了。导出的示例代码粘贴在下面



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

推荐答案

我猜你使用了不常用的字体来处理文本字段,公式等对象水晶报道。所以只需验证报告中的字体即可。我曾经有同样的问题,我验证了对象的字体,它是Calibri或我认为的东西。因此,您需要在生产服务器中安装字体,或者使用常规字体(如Arial,Tahoma,Verdana)更改水晶报表中的对象字体。
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.


我在CR2008中遇到了同样的问题Calibri字体;看起来问题是特定于此字体并导出为PDF。我还在研究是否有可行的解决方法;如果是的话,我会相应更新。



http://www.sdn.sap。 COM / IRJ / servlet的/ PRT /入口/ prtroot / com.sap.km.cm.docs / oss_notes_boj / sdn_oss_boj_bi / SAP(bD1lbiZjPTAwMQ ==)/ BC / BSP / SPN / scn_bosap /笔记%7B6163636573733d36393736354636443646363436353344333933393338323636393736354637333631373036453646373436353733354636453735364436323635373233443330333033303331333533343337333933363331%7D.do [ ^ ]
I had the same problem in CR2008 with the Calibri font; it looks like the problem is specific to this font and exporting to PDF. I'm still researching if there's a viable workaround; if so, I'll update accordingly.

http://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/oss_notes_boj/sdn_oss_boj_bi/sap(bD1lbiZjPTAwMQ==)/bc/bsp/spn/scn_bosap/notes%7B6163636573733d36393736354636443646363436353344333933393338323636393736354637333631373036453646373436353733354636453735364436323635373233443330333033303331333533343337333933363331%7D.do[^]


这篇关于导出为pdf时,Crystal Report会显示奇怪的字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆