SSRS Report Builder 未正确显示数据库中的富文本(仍显示标签)
SSRS Report Builder not showing Rich Text from DB properly (Still Showing Tags)
我正在使用 SSRS(特别是 Report Builder)从 SQL Server 2012.Report Builder 3.0 生成一些相当基本的报告。当我从数据库中添加一个存储为富文本(带有标签和所有标签)的字段时,它只是在报告上显示所有这些标签,而不是显示格式正确的文本。
我尽可能多地研究工具,但找不到让该字段以格式化方式显示的方法。
是否有我遗漏的功能或设置可以使文本正确显示?
我认为不可能在 SSRS 报告中显示富文本格式。
您可以将 Rich Text 呈现为图像文件,然后在报表上显示该图像。
但是,可以使用 HTML 标记,这对您也可能有用。
To add HTML from a field in your dataset into a text box
On the Insert tab, click List. Click the design surface, and then
drag to create a box that is the size you want.
The Dataset Properties dialog box opens. You can use a shared dataset or a
dataset embedded in your report. For more information, click Dataset
Properties Dialog Box, Query (Report Builder) or Dataset Properties
Dialog Box, Query.
On the Insert tab, click Text Box. Click in the list, and then drag
to create a box that is the size you want.
Drag an HTML field from your dataset into the text box. A
placeholder is created for your field.
Right-click the placeholder, and then click Placeholder Properties.
On the General tab, verify that the Value box contains an expression that evaluates to the field you dropped in step 3.
Click HTML - Interpret HTML tags as styles. This causes the field to
be evaluated as HTML.
Click OK.
Source: MSDN - Add HTML into a Report (Report Builder and SSRS)
这意味着您有几个选择:
- 您可以编写一个函数来删除富文本标签,让您显示纯文本。
- 将富文本呈现为图像文件并在报表上显示图像。
- 您不再在数据集中使用富文本,而是开始使用 HTML 标记。
- 编写一个函数,用等效的 HTML 样式标签替换 Richt 文本标签。这会多做一些工作,但仍然是一个有效的解决方案。
我正在使用 SSRS(特别是 Report Builder)从 SQL Server 2012.Report Builder 3.0 生成一些相当基本的报告。当我从数据库中添加一个存储为富文本(带有标签和所有标签)的字段时,它只是在报告上显示所有这些标签,而不是显示格式正确的文本。
我尽可能多地研究工具,但找不到让该字段以格式化方式显示的方法。
是否有我遗漏的功能或设置可以使文本正确显示?
我认为不可能在 SSRS 报告中显示富文本格式。
您可以将 Rich Text 呈现为图像文件,然后在报表上显示该图像。
但是,可以使用 HTML 标记,这对您也可能有用。
To add HTML from a field in your dataset into a text box
On the Insert tab, click List. Click the design surface, and then drag to create a box that is the size you want.
The Dataset Properties dialog box opens. You can use a shared dataset or a dataset embedded in your report. For more information, click Dataset Properties Dialog Box, Query (Report Builder) or Dataset Properties Dialog Box, Query.
On the Insert tab, click Text Box. Click in the list, and then drag to create a box that is the size you want.
Drag an HTML field from your dataset into the text box. A placeholder is created for your field.
Right-click the placeholder, and then click Placeholder Properties. On the General tab, verify that the Value box contains an expression that evaluates to the field you dropped in step 3.
Click HTML - Interpret HTML tags as styles. This causes the field to be evaluated as HTML.
Click OK.
Source: MSDN - Add HTML into a Report (Report Builder and SSRS)
这意味着您有几个选择:
- 您可以编写一个函数来删除富文本标签,让您显示纯文本。
- 将富文本呈现为图像文件并在报表上显示图像。
- 您不再在数据集中使用富文本,而是开始使用 HTML 标记。
- 编写一个函数,用等效的 HTML 样式标签替换 Richt 文本标签。这会多做一些工作,但仍然是一个有效的解决方案。