This question asks how to restrict for a whole server. I just want to do so for a single report. I found a code snippet but it doesn't provide any clues on how to implement:
foreach (RenderingExtension extension in this.reportViewer.LocalReport.ListRenderingExtensions()) {
if (extension.Name == "PDF") {
((Extension)(extension.GetType().GetField("m_serverExtension", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance).GetValue(extension))).Visible = false;
}
I can't see how to make the report reference this code upon loading. Does anyone know how I am supposed to make the report execute this code?
EDIT: Incidentally report access is through the SSRS Report Manager web app. We are, in the main, delighted with this product so wouldn't consider reinventing the wheel in order to implement a hack to produce what is, essentially a "would be nice" feature.
It still boggles the mind slightly that the report's available rendering options are not controllable at the report level. Ho hum.
Incidentally I found this blog entry which clarifies the above code a little. Turns out we're talking about using a reportviewer component to limit the export options. Apparently this requires a dirty, dirty hack and besides it's not how we want to run our reporting function.
So unless anyone has a better idea than this within the next fortnight I'll mark this as the answer which basically sums up to:
You can only restrict functionality like this under certain conditions and by no means easily even when you do.
This seems like a clear failure in the wider fitness of SSRS for purpose as we have users who require Excel export functionality and users who need to be limited to PDF only. Oh well.
Does it matter?
Once they've downloaded the data and taken it offsite, you've lost it anyway.
You haven't really described how you are calling the reports - have you created some kind of application? Are you actually using the report viewer control?
You can generate a report in a specific format using the report URL and including the rs:Format parameter, e.g.
http://SERVER/reportserver?%2fSomeFolder%2fSomeReport&rs:Command=Render&rs:Format=PDF
The above URL generates the report as a PDF. You can also use the URL to hide the report toolbar etc. so you could create these URLs as links in your application, maybe one using just rs:Command=Render as a "View Report" link and one link that includes rs:Format=PDF as an "Export to PDF" link.
More on Reporting Services URL access.
Related
I 'm currently working on creating a web learning portal using ASP.NET MVC 4, where my clients requirement is that the end user should not be able to save the file. The save restriction is applicable on all video type files, images, pdf, word docs and powerpoint type files.
I understand the following exceptions and the client is good with this:
User can make use of print screen
copy-paste text
I need your guidance how best to accomplish this.
For video, I came across the following link http://www.strathweb.com/2013/01/asynchronously-streaming-video-with-asp-net-web-api/.
Thanks,
Hemant.
I came across this online tool http://www.docspal.com/ but they doesn't seems to provide any API for the developers.
Am I the only one with this requirement :(
It is really hard to stop users from copying documents from the website.
However, just to lower it down, you should be able to disable right click which may at least decrease the number of users that will try to copy your content. Do something like following in jQuery.
$(document).bind('contextmenu', function (e) {
e.preventDefault();
alert('Right Click is not allowed');
});
Refer to this for more.
Ok I've tried this in every possible combination... I know this can be done in Access, so I know it can be done in C#...
What I'm trying to do is set up a print button, that when clicked, organizes data from various controls on my form into specific positions on a predefined template. Like say I'm generating a Job Estimate, and I want to print it... It would look silly printing the control or form, so I'd like it organized into a neat standard format on a page, that may include a logo etc. I don't want the data exported to a document, I just want the print button to auto-generate this so that it can be printed from the application.
Can anyone point me to some resource that deals with this? I have googled my mind away, and searched all over stack overflow, but I'm not even sure what the correct wording to look something like this up with is, as it keeps giving me c++ or some other random stuff to look at that has nothing to do with what I am looking for....
What you are looking for is a reporting tool, which can render a structured report to screen, or to print or to a file format like PDF.
Many reporting tools exist for .Net development, Crystal Reports, Active Reports, Reporting Services in SQL Server.
Ok, so I'm building a kind of reporting central for the company I work at and the easy part was building a web based file browser, now I'm moving on to the report aspect of it and to start it off, I'm integrating Crystal Reports.
I've already gotten the files from the SAP website for them, but I'm encountering a couple problems,
First off, all the examples I've found make it so that you have to define the data source/database, and include log in information for it in the code. This is a problem because we have a LOT of crystal reports, with a lot of different database references, so I can't just use one for all of them. In fact, there are reports that we use that reference multiple database at the same time.
Secondly, all the examples I've found make it seem like you have to have a specific page created for each report. My goal is to be able to have the report link as a variable and have one page for all of the reports we have.
I looked at everything I could find yesterday and I couldn't find what I needed. I'm also wondering what on earth the ReportClass.Load function even does. It was in every example I could find and I didn't notice any explicit difference in the ReportClass I had when I used it.
While searching, I found an answer that suggested building a web forms application that would build the Reports, and then use an I-Frame to grab it, but that's something I want to avoid.
So in review:
1) I need to build Crystal Reports without having to reference the Database
2) I need it to be flexible to a variable Report by supplying just the path to the .rpt file
3) I would like it to be in a single application, in MVC, and avoiding IFrames
Thank you so much for your help!!
EDIT: I found a solution that works for me. Instead of using a RAZOR view, I used an ASPX view, which has the Crystal Reports Viewer Tool in the toolbox. In order to make it variable I used the ViewBag.
Controller Code:
[HttpGet]
public ActionResult Viewer(string Path)
{
var sessionID = Session.SessionID;
ViewBag.Path = newPath;
return View();
}
ASPX View Code:
<% Report.Report.FileName = ViewBag.Path; %>
<CR:CrystalReportViewer ID="Viewer" runat="server" AutoDataBind="True" GroupTreeImagesFolderUrl="" Height="100%" ReportSourceID="Report" ToolPanelWidth="200px" Width="100%" />
<CR:CrystalReportSource ID="Report" runat="server">
<Report></Report>
</CR:CrystalReportSource>
A "similar" (not exact) question was asked here. Hopefully that can get you down the right path.
1) I need to build Crystal Reports without having to reference the Database
Have you considered building a data warehouse for your reporting and analysis needs? A data warehouse has many benefits over a traditional reporting structure especially when drawing data from multiple sources.
In regards to point 2 & 3 have you considered that crystal reports may simply not be the most ideal reporting solution?
Crystal reports is a powerful tool but honestly I'm not a big fan of it when it comes providing reporting intelligence over the internet or an intranet.
Having you considered switching tools? For example http://www.tableausoftware.com/ provides some excellent data visualization tools and IMO is a much better tool for the job you are describing.
Note, that this is simply one tool (as there are many out there), but one that I have had some experience with and it exceeded our expectations especially when sitting on top of a data warehouse.
I'm currently having a couple of reports which I print from my Forms applications.
However building printed reports only with the built-in .NET printing methods is very tedious. Even just printing a simple table on a couple of pages with a little bit of formatting is a task for a couple of hours (if it should look nice).
What I need is a WYSIWYG-Designer for the layouts, so I'd like to write one.
It shouldn't be for End-Users, but for me as a developer, it's just about to create the layout what the report will look like with various arrangements/fonts/images/formats and so on and not have to do that by trial & error in code (and restart the app a zillion times).
So my specific questions:
What would I use as a canvas for editing and display of the report? An image-control/bitmap which I draw upon like on the printed document? Is there a better way?
Is drawing on a form comparable to drawing on a printed page? What about differences in resolution printer vs. screen?
How to get real WYSIWYG? Should I get the printer settings and create my canvas with the same resolution? Is there something else to consider?
I know that there are report designers around but I think it's sometimes good to understand the basic working principles of what you use and implementing them is for me the best way to do that.
I'm aware that this is not a specific question A to which the answer is always B, but if it were that way I would find an answer in Google pretty quickly.
Thanks in advance!
I can't say much about designing a WYSIWYG editor, but I have written a few custom in-house reporting engines for use by our development team.
There's two main ways I've created reports. The first is using PDFsharp (MIT-licensed) to manually layout pages which isn't for the faint-of-heart.
The second is using Winnovative's HTML to PDF library (not free, but royalty-free) which uses the current installed version of IE to do the layout and spit out a PDF. It looks like they've recently released a new version called EVO PDF which I have never used before.*
For the HTML to PDF solution, it supports JavaScript so you can add in charts from JavaScript libraries like flot or jqplot.
*I'm not affiliated with Winnovative.
You might want to save time and use Visual Studio HTML designer as your WYSIWYG editor.
What I'm currently doing is using ASP.NET MVC 3 as a simple reporting engine. You can use the MVC pattern to really separate your reporting data source (Model) and the rendering (View) while using Visual Studio as your report designer.
From your application you can easily call your actions with the report optional parameters. For example:
http://localhost/Report/Customer/Orders/1
You simply get the returning string from a WebClient's DownloadString method and you have your report generated.
There is some down side using HTML, mainly the difficulties to know when a page would break, but by using code in your View you can calculate the amount of repeating items and add a CSS break-page and re-starting your table's header on the next page.
You can achieve anything from graphics, to table, you can even generate link to other reports.
HTH.
Printing Reports in Windows Forms
http://msdn.microsoft.com/en-us/library/ms996472.aspx
I'm hoping people have some ideas to help solve this problem.
I am developing a C# ASP.NET website and the client requires an online form that users will fill in and submit. OK, so far so good.....
Imagine, say, a form that you fill in on paper - they normally have a distinctive look specific to the company and will be filed, quite possibly as a legally binding document.
I need to have an online form that when submitted emails the client with something they can print out and will look exactly like their printed forms.
As this is web based, I think the option of capturing a screenshot are out the question, so I'm wondering how best to approach this?
Even if I just had a form that captures the data presented how I want, how could I translate this data into the view they want?
Any ideas and suggestions greatly appreciated.
You'll need to take the raw data that was submitted and import it into a standard document (likely PDF). You can use Crystal or another reporting solution, or direct to PDF using one of the many PDF .NET solutions that are out there.
I don't think you'd even want to deal with making the document physically match the screen - much easier to make the web look like the web, and make the printed doc look like a printed doc.
Print a page (this one) from a Browser, notice all the headers and footers?
If you want serious control over how it is going to look, you will need to generate a PDF (or maybe XPS).
Couldn't you just use a sepparate page with a CSS that gives the desired look & feel?