Can I get a tab to display in a rendered report?

十年热恋 提交于 2019-12-14 02:13:41

问题


I have built an RDL report and after rendering any tab characters contained within my returned data do not appear in the generated report. Is it possible to display tab characters? (Users want to have the basic formatting of their 'comments' field to appear.) Tabs added to the rdl itself are maintained, but those in the data seemed to be stripped out by the rendering engine.


回答1:


The problem is that SSRS rendering it's output like HTML, which ignores consecutive whitespaces and treats tabs as single spaces.

Probably the best you can hope for is either to replace the tabs in your SQL query or replace them inline in your textbox. I had the same problem where I had certain HTML tags that needed to be stripped out and I had to do it using an inline replacement.

You should be able to replace the tab with non-breaking spaces. Probably the clearest replacement is:      

Your replacement will look something like:

=Replace(MyTable.FieldName, Chr(9), "     ")

If you were do to do it in SQL, it would look something like:

REPLACE(MyTable.FieldName, CHAR(9), '     ')

You can also look at Strip HTML from string in SSRS 2005 (VB.NET) for more examples on how to do inline replacement.



来源:https://stackoverflow.com/questions/3048949/can-i-get-a-tab-to-display-in-a-rendered-report

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!