Uredi

Deli z drugimi prek


Tutorial: Format a report (Reporting Services)

After you add the table to your report, you use SQL Server Data Tools (SSDT) to format the date field, currency field, and the column headers in the Sales Orders report.

In this tutorial, you:

  • Format the date field to display only the date.
  • Format the currency field to display as currency.
  • Change text style and adjust column widths.

Prerequisites

Format the date

The [Date] field expression displays date and time information by default. You can format it to display only the date.

  1. Open your Sales Order report definition file (.rdl) in Visual Studio.

  2. On the Design tab, right-click the cell with the [Date] field expression and then select Text Box Properties.

  3. Select Number, and then choose Date from the Category box.

  4. In the Type box, select January 31, 2000.

  5. Select OK.

  6. Preview the report to see the change to the [Date] field formatting, and then go back to the Design tab.

Format the currency

The [LineTotal] field expression displays a general number. You can format the field to display the number as currency.

  1. Right-click the cell with the [LineTotal] expression, and select Text Box Properties.

  2. Select Number, and then choose Currency from the Category list box.

  3. If your regional setting is English (United States), the defaults in the Type list box are:

    • Decimal places: 2
    • Negative numbers: ($12345.00)
    • Symbol: $ English (United States)
  4. Select Use 1000 separator (,). If the sample text displays $12,345.00, then your settings are correct.

  5. Select OK.

  6. Preview the report to see the change to the [LineTotal] expression column and then go back to the Design tab.

Change text style and column widths

You can add other formatting to your report by highlighting the header, and then adjusting the widths of the data columns.

  1. Select the table so that column and row handles appear on the top and side of the table. The gray bars along the top and side of the table are the column and row handles.

  2. Hover over the line between column handles so that the cursor changes into a double arrow. Drag the columns to the size you want.

    Screenshot of a table showing the double arrow cursor between two columns.

  3. Highlight the row containing column header labels and then select Format > Font > Bold.

  4. Preview the report on the Preview tab.

    Screenshot of a table preview with bold column headers as well as updated currency and date values.

  5. Select File > Save All to save the report.

Next step