Author |
Topic |
kselvia
Aged Yak Warrior
526 Posts |
Posted - 2004-11-09 : 14:02:14
|
I am using RS to generate reports of imported text files received from outside vendors. A stored procedure extracts some key information from each file heading and stores the text in tables.I want the report to display just like the original text file. I have used Courier New monotype for fixed-width fonts to make things line up correctly. My problem is that mutiple spaces are colapsed to a single space when viewing the report in IE. When exporting to PDF or viewing the report in VS the spaces are shown. The HTML source ends up looking like this:<DIV class="r11"> XYZ ABC</DIV> and IE displays this (removing leading spaces and eliminating multiple spaces):XYZ ABC I tried replacing spaces with </DIV>%nbsp;<DIV class="r11"> but RS just escape-quoted that and included it in the report. Any suggestions?--KenI want to die in my sleep like my grandfather, not screaming in terror like his passengers. |
|
kselvia
Aged Yak Warrior
526 Posts |
Posted - 2004-11-10 : 01:28:00
|
I thought that was a great idea, but it didn't work. I replaced spaces with ~ and used a formula to change ~ to space but all spaces were still collapsed. I tried changing ~ to . to make sure I was getting the right data and sure enough I had pages full of .'s.Any suggestions, because if you made it work, something is different.I have a single varchar(255) field called data.BTW: I realized I was wrong about formatting when exporting to PDF. It does show multiple embeded spaces, but leading spaces are also stripped there. Seems to be a known problem: http://www.sqlmonster.com/Uwe/Forum.aspx/sql-server-reporting/3399/Export-to-PDF-trims-leading-spacesI had high hopes for your suggestion though! --KenI want to die in my sleep like my grandfather, not screaming in terror like his passengers. |
 |
|
ditch
Master Smack Fu Yak Hacker
1466 Posts |
Posted - 2004-11-10 : 01:46:16
|
Oops - sorry ken - i deleted the message - it said this: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~Hi Ken,Give this a try.In the sql replace all spaces with some arb character that you know wont appear in the data.I am going to use a comma (",") in this case.Then when you enter the formula in the table fields of your rs project replace this character again back to space.I just tried it, it worked.The formula should look something like this :=Replace(Fields!Field1.Value, ",", " ")Hope this helps :)Duane.~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~after trying it in the designer it worked, but I had not tested the deployed solution in IE though, I was hoping that you wouldn't notice it so that I could try again.Duane. |
 |
|
Bsallee
Starting Member
5 Posts |
Posted - 2004-11-11 : 14:08:56
|
I was having the same problem and you guys were on the right track.here is what I did to fix the issue.=Replace(Fields!Field1.Value, " ",chr(160))This replaces all spaces in the report with non breaking spaces which html will display. Other applications will treat the spaces just like regular spaces to boot.Hope this helps.-Brian |
 |
|
kselvia
Aged Yak Warrior
526 Posts |
Posted - 2004-11-11 : 16:01:12
|
Thanks Brian! Works like a charm!If you have any ideas on how to retain leading spaces on PDF exports please let me know.--KenI want to die in my sleep like my grandfather, not screaming in terror like his passengers. |
 |
|
Bsallee
Starting Member
5 Posts |
Posted - 2004-11-11 : 16:32:15
|
As far as I know that is a real bug with the PDF format and not something which there is a likly workaround on. The ignoring of spaces in HTML is a feature (arguably) and the non breaking space characte chr(160) is used to address that issue specifically ( is the code used to render a non breaking space in html and produces the same character as chr(160))So I would go pester adobe :) A lot :) |
 |
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2004-11-11 : 16:49:49
|
HTML can preserve whitespace by embedding text in a <pre></pre> tag set. |
 |
|
kselvia
Aged Yak Warrior
526 Posts |
Posted - 2004-11-11 : 16:54:12
|
But you can't embed <pre> tags in data fields because if you do, Report Server converts them to & lt ;pre & gt ; ( spaces inserted to make snitz not convert ;)) which is what you would expect or you would not be able to create a report that contained the string <pre>--KenI want to die in my sleep like my grandfather, not screaming in terror like his passengers. |
 |
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2004-11-11 : 17:08:02
|
Ahhh, what I had wanted to say was there is a CSS attribute called "white-space" that you can set to "pre" for any element that will preserve white space:http://www.w3c.org/TR/CSS1#white-spaceI had thought there was something in CSS that could do this but couldn't remember what it was. This should be an available property through the properties page in the RS report designer. If not, you should be able to create a style with this attribute set and then apply the style to the element(s). |
 |
|
Bsallee
Starting Member
5 Posts |
Posted - 2004-11-12 : 09:35:54
|
You can only apply css to the RS Toolbar. There is no way to modify or apply CSS to the report itself. When they (MS) introduced CSS support in RS SP1 it was only to control the RS website look and feel and not the data in the reports. Had we have been able to manipulate CSS for the reports themselves then this would have been a moot issue. Heres hoping MS wishlits this feature for future versions.-B |
 |
|
|