Export (0) Print
Expand All

Formatting Reports using Cascading Style Sheets

Visual Studio 2005

Instead of formatting report objects or sections in the embedded Crystal Reports Designer, you can use classes in a cascading style sheet (CSS) to apply formatting to reports viewed over the Web.

Generally, when you create a report, you format a particular report object (for example, a database field or text object) within the embedded Crystal Reports Designer. When the report is rendered into HTML and viewed through a Web Forms Viewer, these formatting options are automatically converted into HTML. To change the formatting of the HTML page, you would need to make a change to the Crystal report itself.

The Set CSS Class option enables you to apply CSS classes to report objects and to sections of a report, instead of manually changing the formatting of the report. You specify the name of the class and its scope in the embedded Crystal Reports Designer and then specify the value of the class within the .aspx file of your project or through an external style sheet. The external style sheet or the formatting specified in the .aspx file is then applied to the report when the report is rendered into HTML.

To format reports using CSS class values

  1. Right-click in the embedded Crystal Reports Designer and select Set CSS Class.
  2. In the Object Scope field, select the objects or sections you would like the class to be applied to.
  3. Enter the name of the class in the CSS Class Name field.
    Tip   Use CssClass in the Properties window to view, edit, or delete the class values for a specific report object or section.
  4. Click OK.
  5. Save the report.
  6. Access the .aspx file in your project.
  7. In the HTML tab of the .aspx file, reference an external style sheet that has the class already defined, or enter the class value.

    For example:

       background-color:808080; border-color:000000; color:000000; font-family:Arial; font-weight:bold; font-style:italic; }

See Also

Absolute Formatting | Conditional Formatting | Formatting Report Sections | Enhancing Report Presentation

© 2014 Microsoft