Html SSRS:如何在 sql 服务报告中显示超链接

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/14878752/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 05:37:24  来源:igfitidea点击:

SSRS: How to display a hyperlink in sql services reporting

htmlreporting-servicesssrs-2008

提问by bearaman

I'm using SSRS for 2008 R2 to display some data-generated reports. In my database table, I have a cell called Remarks. It usually contains links to software defects. The cell is nvarchar(max) and I've added links such as http://stackoverflow.com. However, when the report is displayed, the link is not clickable as expected. What do I need to do make the link clickable? Many thanks for any help. J.

我使用 SSRS for 2008 R2 来显示一些数据生成的报告。在我的数据库表中,我有一个名为 Remarks 的单元格。它通常包含指向软件缺陷的链接。该单元格是 nvarchar(max) 并且我添加了诸如http://stackoverflow.com 之类的链接。但是,当显示报告时,链接无法按预期点击。我需要做什么才能使链接可点击?非常感谢您的帮助。J。

回答by Bryan

Two approaches, the first assumes data is pre-formatted as a URL (e.g. https://www.google.com). The second assumes the URL is contained within some other text (e.g. 'This is a link to Google').

两种方法,第一种假设数据被预先格式化为 URL(例如https://www.google.com)。第二个假设 URL 包含在其他一些文本中(例如,'This is a link to Google')。



URL Only

仅网址

  1. Right-click the field in design view, select Text Box Properties. Report Builder Field Right-Click

  2. Select the Actionpane, select the Go to URLradio button.

  3. In the Select URLtextbox, enter the field value expression. Field Action URL

  1. 在设计视图中右键单击该字段,选择Text Box Properties报表生成器字段右键单击

  2. 选择Action窗格,选择Go to URL单选按钮。

  3. Select URL文本框中,输入字段值表达式。 字段操作 URL



URL Embedded in Text

嵌入在文本中的 URL

  1. Double-click the field in design view, then right-click Create Placeholder. Report Builder Placeholder

  2. In the Valuetextbox, enter the field value expression containing HTML tags.

  3. Under Markup Type, check the HTML - Interpret tags as stylesradio button. Report Builder Placeholder options

  4. Verify link is displayed when report is run. Report Builder Placeholder Output

  1. 在设计视图中双击该字段,然后右键单击Create Placeholder报表生成器占位符

  2. Value文本框中,输入包含 HTML 标记的字段值表达式。

  3. 在 下Markup Type,选中HTML - Interpret tags as styles单选按钮。 Report Builder Placeholder options

  4. 运行报告时是否显示验证链接。 Report Builder Placeholder Output



回答by glenn garson

How to create a text box in the title area that is a hyperlink (opens in another window)

如何在作为超链接的标题区域中创建文本框(在另一个窗口中打开)

1] Drag Text box to title area from Toolbar to the design surface

1]将文本框从工具栏拖到标题区域到设计图面

2] Then from the 'Report Data' pane on the left side, drag any field from the dataset into the text box {this is to create a 'placeholder' rather than a plain 'textbox'

2]然后从左侧的“报告数据”窗格中,将数据集中的任何字段拖到文本框中{这是为了创建“占位符”而不是普通的“文本框”

3] Right click on the field, in the textbox, go to 'Placeholder Properties'

3]右键单击该字段,在文本框中,转到“占位符属性”

4] in the action Pane, of the 'Placeholder Properties' window, click 'Go to URL', then click the fx, i.e. expression button, and paste the following into the expression:

4] 在“占位符属性”窗口的操作窗格中,单击“转到 URL”,然后单击 fx,即表达式按钮,并将以下内容粘贴到表达式中:

="javascript:void(window.open('http://172.15.189.14:64444/ElectronicForms.aspx','_blank'))"

click [ok] to close the expression window

点击【确定】关闭表达式窗口

5] Go to the 'General' tab, in the 'Placeholder Properties' widow. The Value field will be populated with the name of the field that you dragged into the text box, in step2, delete the name of the field. Then click the fx, expression button, and type the following into the expression window:

5]转到“占位符属性”窗口中的“常规”选项卡。值字段将填充您拖入文本框中的字段名称,在步骤 2 中,删除该字段的名称。然后单击 fx, expression 按钮,并在表达式窗口中键入以下内容:

="Click for Help"

="点击帮助"

Then click [ok] to close the expression window

然后点击【确定】关闭表情窗口

Then click [ok] to close the 'PlaceHolder Properties' window

然后单击 [确定] 关闭“PlaceHolder 属性”窗口