1421021 - Fields in the Crystal Reports DHTML viewer for VS .NET overlap

SAP Knowledge Base Articles - public

1421021 - Fields in the Crystal Reports DHTML viewer for VS .NET overlap


  • Fields placed next to each other in the Crystal Reports designer overlap when viewed in a web application
  • The fields do not overlap in the CR designer


  • Crystal Reports 2008 SP1 / SP 2
  • Windows XP SP2 / Server2003 SP2
  • IIS 6 / 7
  • Visual Studio 2008

Reproducing the Issue

  1. Add 2 string fields with long text values to a report.
  2. Decrease the 1st field to the point that text will be truncated.
  3. Move the fields close together
  4. Save the report.
  5. View the report in a web application.


  • The Visual Studio .NET WebForms Crystal Report Viewer requires knowledge of the client-side screen DPI to properly compose the report.
  • Absolute formatting that the Crystal Report Viewer needs requires knowledge of the screen DPI that the client machine is running.
  • The DPI value is then specified using the property CrystalReportViewer.RenderingDPI


  • There's no standard JavaScript that works across all browser types.
  • A workaround is to create a page specific to determining this by measuring an object of 1 inch in height in pixels.
  • The following HTML page will achieve the above
Redirecting to viewer…
<div id="dpi" style="height: 1in; left:-100%; position: absolute; top:-100%; width: 1in"></div>
<script type="text/javascript">
window.location = "Viewer.aspx?dpi=" + document.getElementById("dpi").offsetHeight;
  • The above page creates a div named "dpi" 1inch x 1 inch, and places it off the visible page.
  • The JavaScript then redirects to the Viewer page (Viewer.aspx), where the HTTP Get parameter "dpi" is set to be equal to the 1 inch box measured in pixels.
  • Then in the Viewer.aspx page, retrieve this value and specify the DPI for the viewer:
protected void Page_Load(object sender, EventArgs e)
int dpi = Convert.ToInt32(Request["dpi"];
 CrystalReportViewer1.RenderingDPI = dpi;


forum thread , KBA , BI-DEV-NET , BI Software Development Kits (SDKs) - .NET or Other , How To


Crystal Reports 2008 V1