开发者

Reporting Services Line Breaks When Exported Not In HTML

开发者 https://www.devze.com 2023-01-27 10:32 出处:网络
In Reportings Serivces 2005..I have a matrix control with a the below expression in one of the cells. The problem is that all these lines are running together when viewed from the report viewer. It do

In Reportings Serivces 2005..I have a matrix control with a the below expression in one of the cells. The problem is that all these lines are running together when viewed from the report viewer. It does, however, export in the correct format (pdf, excel). This is a little issue but its drving me nuts. I use the same technique on other reports and they display as expected.

Expression:

=Fields!FullName.Value + " (" + Fields!Id.Value.ToString() + ") "
+ chr(10) + chr(13) 
+ "dob " + Format(Fields!DateOfBirth.Value, "MM/dd/yyyy")
+ chr(10) + chr(13) 
+ "Days Enrolled: " + Fields!OriginalDaysEnrolled.Value.ToString()
+ chr(10) + chr(13) 
+ "45 Day: " + Fields!ItemStringFor45Day.Value
+ chr(10) + chr(13) 
+ "开发者_C百科90 Day: " + Fields!NinetyDay.Value.ToString()
+ chr(10) + chr(13) 
+ "Current: " + Fields!CurrentDescription.Value
+ chr(10) + chr(13) 
+ "Open Follow Ups: " + Fields!FollowUpCount.Value.ToString()

Web Appearance (IE7, haven't checked others)

Doe, Johnny (123456) dob 03/30/2009 Days Enrolled: 98 45 Day: V H Deca Dev 90 Day: 18 Month Current: 18 Month Open Follow Ups: 1

Exported Appearance (as expected and as Web should look)

Doe, Johnny (123456)

dob 03/30/2009

Days Enrolled: 98

45 Day: V H Deca Dev

90 Day: 18 Month

Current: 18 Month

Open Follow Ups: 1


I figured this out after checking a report that was working correctly (for the fifth time)...it's simple.

I used:

+ chr(10) + chr(13)  

but I should have used:

+ chr(13) + chr(10)  

I feel silly for overlooking it for so long, but I guess it never popped out at me.


White space is just white space to HTML; it condenses all the white space to a single space for presentation (including your chr(10) + chr(13)). In order for a line break, you either have to use a <br /> tag or surround your line break values with <pre></pre>.

If you save the following as a ".html" file, you'll see that all characters will be displayed on the same line.

<html>
    <body>
        This is
        my          test
        for
        line breaks!
    </body>
</html>

However, this will yield the line breaks you want.

<html>
    <body>
        <pre>
            This is
            my          test
            for
            line breaks!
        </pre>
    </body>
</html>

Easiest thing for you to do though is to replace your chr(10) + chr(13) with <br />. PDF and Excel will still respect the tag as a line break. If <br /> doesn't work, try &lt;br /&gt; - I can't remember if Reporting Services encodes its output or not.

0

精彩评论

暂无评论...
验证码 换一张
取 消