Thursday, March 29, 2012

Embedding literals in RDL that will come through in HTML

I am trying to create some reports that when rendered in HTML are supposed to have some interactivity built into them. I understand that there aren't any facilities in RDL itself that would help facilitate this process for me, but is there any way to embed some literal strings that will come through in the HTML?

The items I'm trying to finesse through are <script> blocks, checkboxes, and <object> tags. When I use the designer to put these items into textboxes, they get encoded with the HTML values (&gt; instead of >, etc...) so that the code is displayed instead of interpreted.

I thought maybe there would be a VB function that I can wrap around the HTML to prevent it from being encoded so that when the report is displayed on the screen that the interactive elements are there.

Any ideas?

I think this relates to formatting text within a cell, which does not appear to be possible. Perhaps some sort of javascript which will change the innerHTML of the report document?|||

Thanks for the response.

I think that I have solved the problem for my situation. Here's what I've discovered so far:

If you use a textbox control, you can set the value of it to an HTML snippet (I'm using an object tag with some param tags as well as checkbox controls). When the report is rendered to HTML, the HTML that was embedded into the report shows as source on the page. I've taken that HTML, saved it off to a file and modified it using some .NET classes. Specifically the HTTPUtility.HtmlDecode function. That function will take the HTML file and undo all of the encoding that Reporting Services has done to your HTML. I also did a small test where I inserted a "&lt;" character somewhere else in the HTML document to simulate something that may actually occur. When I decoded the file that time, all of the encoded HTML snippets were properly decoded, and the less than sign was left alone.

If someone were rendering using the Web Service APIs for Reporting Services, this would work because you are given the stream back. In the case of using a WebForms ReportViewer though, it might be more difficult.

I hope this helps anyone who has a similar problem.

|||Sounds interesting, can you post the code or a snippet of it?
This may help MS to build as a feature in the next SP as this seems like a pretty common thing (how do I embed html/change style within a text box)|||

Hi Ken,

i'm new with sql reporting service, may i know anyway to make my report export with html format and allow me to send to customer using the ms outlook?

my report contain chart and also table, and image.

i did trying to export using mhtml, but after i send it using the email. at my desktop i able to see it. but my manager not able to read all the image and chart.

thanks for your help.

|||

Hello,

Can you please share the code or detail the approach you have taken?

Thanks

No comments:

Post a Comment