Crystal Reports(预览)和Crystal Reports Viewer(导出)之间的舍入不一致

时间:2013-11-08 17:11:51

标签: asp.net crystal-reports crystal-reports-viewer

我有一份报告显示不同项目的不同费率。其中一项是“里程”,其费率为小数分(0.565)。

我们希望显示这些费率的完整0.565,并显示带有两位小数的所有其他费率。

为方便起见,我在Format Field > Number > Customize中使用了DecimalsRounding的公式,看起来基本上是这样的:

if({RATE_TYPE}='MILEAGE')then 3 else 2

这似乎在Crystal Reports中正常运行。里程数,显示3位小数,并且舍入到小数点后3位。

在Crystal Reports Viewer(以及后续导出)中,它显示3个小数位它将舍入到2个小数位。

我正在使用Crystal Reports 2008(12.3.0.601)和Crystal Reports Viewer:

<system.web>
  <sectionGroup name="businessObjects">
    <sectionGroup name="crystalReports">
      <section name="rptBuildProvider" type="CrystalDecisions.Shared.RptBuildProviderHandler, CrystalDecisions.Shared, Version=12.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304, Custom=null"/>
    </sectionGroup>
  </sectionGroup>
  ...
  <compilation debug="true" defaultLanguage="c#">
    <assemblies>
      ...
      <add assembly="CrystalDecisions.Web, Version=12.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
      <add assembly="CrystalDecisions.Enterprise.InfoStore, Version=12.0.1100.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
      <add assembly="CrystalDecisions.ReportSource, Version=12.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
      <add assembly="CrystalDecisions.CrystalReports.Engine, Version=12.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
      <add assembly="CrystalDecisions.ReportAppServer.ClientDoc, Version=12.0.1100.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
      <add assembly="CrystalDecisions.Shared, Version=12.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
      <add assembly="CrystalDecisions.Enterprise.Framework, Version=12.0.1100.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
      ...
    </assemblies>
    <buildProviders>
      <add extension=".rpt" type="CrystalDecisions.Web.Compilation.RptBuildProvider, CrystalDecisions.Web, Version=12.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
    </buildProviders>
  </compilation>
  ...
  <httpHandlers>
    ...
    <add verb="GET" path="CrystalImageHandler.aspx" type="CrystalDecisions.Web.CrystalImageHandler, CrystalDecisions.Web, Version=12.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
    ...
  </httpHandlers>
  ...
</system.web>
<system.webServer>
  ...
  <handlers>
    ...
    <add name="CrystalImageHandler.aspx_GET" verb="GET" path="CrystalImageHandler.aspx" type="CrystalDecisions.Web.CrystalImageHandler, CrystalDecisions.Web, Version=12.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304" preCondition="integratedMode"/>
    ...
  </handlers>
  ...
</system.webServer>

(对代码墙感到抱歉)

之前有没有遇到过这个?有没有已知的修复方法?

1 个答案:

答案 0 :(得分:1)

您需要设置小数的默认值并四舍五入到您尝试实现的最大值。所以在你的情况下它将是3.