Applying CSS styles to RDL file - css

Is there any way to apply CSS styles to an SSRS rdl file ?
Note: it's not necessary to BIDS, my main goal is to edit the rdl file regardless of the used tool.
Thanks

From what I read, an RDL file is written in XML so yes, you can use XSLT to turn it into HTML, to which you can apply CSS.

Well sort of. You can do what Mario suggested but you can't really do that to the RDL as is. You need to CALL IT from a service to HTML and then apply a CSS to that. The RDL File contains definitions but not the report data. So if you changed it for markup you would still have to connect to a database and read the RDL language. As far as I know RDL is a propertiary SSRS langauge that needs a converter to tell it how to display. This is generally the service at http:// (servername)/ReportServer which has the information built in that can translate it. You could not alter this file directly without A LOT of work to transform it as it would then need to know a connection string, how the data was presented.
To do what you want I would think you could do this:
Deploy a report
Call a form to be populated in HTML like:
<form id="ssrsform" action="http://(servername)/ReportServer/Pages/ReportViewer.aspx(Path)&rs:Command=Render" method="post" target="_self" >
.....(options and settings)....
</form>
Apply a CSS form to the HTML file directly that is calling the webserivce.
IMHO changing a proprietary language file like RDL before it transmits to HTML would be hard as you need to account for the data you get as well as just the connection string.

Related

How to convert a html table to downloadable excel file ASP.NET C#

I need a function to convert any HTML table to a excel file!
I like to add a button to my page and once that button is clicked I pass a complete HTML table in to such a function that will generate an excel file and past the html table into the file with the same layout and design!
I appreciate any help with this request.
I am using c# and asp.net
This is a nasty trick, but it works in recent version of excel.
You just save the html table as a normal html file, then just rename it to xls. If your application is a web application use response.setHeader("Content-Disposition", "attachment; filename=order.xls").
Recent version of excel support Microsoft Office XML Formats, so if the previous solution doesn't work, you may want to try to generate the xml from the html table.
See XML Spreadsheet Reference.
What I do, is to generate the xml from excel in the xml format, then hack into it. You can implement also advanced features like automatic filters, and cool layouts. I used a template engine to generate the xml (Freemarker, it's Java stuff, but I'm sure there are template engines also for .NET)

A "shortcut" method for exporting an ASP.Net Page to pdf/xls

I want to export a few Pages to pdf/xls. By Pages I mean as the eye sees it - a screenshot of the Page's contents. I know how to build pdf/xls documents using 3rd party tools but is there any way to quickly export the rendered contents of say a Panel?
edit: maybe a tool that can render the page's output as a browser would, and save it as an image file?
There is an open source console program named wkhtmltopdf which you could call from asp.net to convert the page. It can convert to PDF or an image with wkhtmltoimage (JPG, PNG, etc.) using the webkit rendering engine.
Check my answer to this question to see an example of how to convert from a html to a pdf using C#:
Easiest way of porting html table data to readable document
I can recommend http://www.screengrab.org/ for firefox.

XML and XSLT to generate CSS?

I want to provide user facility to change the CSS.
First think clicked is that storing CSS as XML will help me read CSS and understand.
Second is that using XSLT i will be able to generate the CSS (am i right ? will that be useful)
Lastly when user changed the CSS XML file can be updated and then it can be used.
Now this is at very rough level ..... i am using ASP.NET can some one please guide me if my understanding is correct or not and how should i approach for this pros/cons.
Will something like below will work ? is possible?
<link src="someserverfiletoprocessxmlusingxslt.aspx?user=id" type=text/css/>
That is possible; your ASPX page would need to return CSS with a MIME type of text/css.
However, it would be better to use an ASHX (Generic Handler) rather than an ASPX (Web Form).
Using an ASP.NET generic HTTP handlers (ashx) would be better. This is just a class that gives you access to the output stream (better for non-html output).
From there you can process the XML, transform it using XSLT and write/dump it on the output stream.
Might be a good idea to implement some kind of caching to enhance performance...
More info on generic handlers: http://www.brainbell.com/tutorials/ASP/Generic_Handlers_(ASHX_Files).html
Setting the method attribute of the xsl:output element to text will strip the resulting output of all XML tags and return it unencoded.

Multi-lingual static content in ASP.NET

Is there a simple way of making the static content of an .aspx page multi-lingual? Resource files are nice for controls but it's quite hard and annoying to write big chunks of html in them. Any easier ways?
Make properties in resources files and use them, .NET automatically finds the correct resource file, also just make sure so that the property name is same in all the resource files, so it will replace the property value in .aspx page with the value in the resource file.
Don't code html markup in resource file, have the html markup in the .aspx page itself, just get the essential values from resource files.
Just to reiterate what Mahesh said: do NOT put markup in the resource files, just put the static content into them.
If you need to serve different views based on culture, consider doing something else. For example, if you're using MVC you could write a view engine that return the correct markup for each culture.
#ciscoheat what you say is correct, LOCALIZE control is the right thing to use for big chunk of data.

How to display XSL-transformed XML in ASP.NET page?

So far all the XML / XSLT I've worked with takes an XML document and transforms it to a standalone HTML webpage using an XSLT file.
In my web application, I'm using a web service to retrieve the XML document, which I need to render and make human-readable, and then insert that formatted content into a content placeholder in my master page.
The easiest way would be to append the XSLT to the retrieved XML file and link that to the content placeholder, but something tells me I can't just do that.
I took a look at these Stack Overflow pages, but they just want to render the straight XML whereas I want a transformed XML. Also, I need to be able to put it into my master page template.
This article shows how:
http://www.codeproject.com/Articles/37868/Beginners-Introduction-To-XSL-Transform-Rendering-XML-Data-using-XSL-Get-HTML-output.aspx
even if the spelling is as bad as mine...
Added
And here's another link that shows how, perhaps a bit more simply
http://www.aspfree.com/c/a/XML/Applying-XSLT-to-XML-Using-ASP.NET/2/

Resources