I am using client-side reporting capabilities that are bundled in Visual Studio 2010. I've got an RDLC file defined, currently with embedded images for branding purposes at the top of the report. Image is the logo for the user's company. There is nothing to do with the report data ... this is just a title.
I want to be able to break the dependence on embedding the images, because I'm scaled up. Instead, I want to be able to set the image dynamically. Unfortunately there is no such parameter type that it supports.
I have seen the source switch from embedded to external, and maybe to emit an image file of the logo on the program launch (the resources are embedded in a separate assembly form), then the source As a normally nominated file for it. I'm not sure how much I like this option because it looks like a hack. I also get an error when I clearly set the path diagram, effectively saying that the object is not set for an example. For example, I would call it D: \ Test. I have also tried to set up JPG, and have received that error at design time ... so I am more reluctant to try this option.
I also saw a class from within the RDLC file called in a referenced assembly, but I can not seem to do this work. It seems that I can refer to an assembly, then call through a special object called code. Because my class is stable, this code should be. Classname.method, but do not think so.
I have also considered breaking the title in a sub-report, but I still do not think I have solved my dependency problem, it still needs the same amount of maintenance.
Let me tell you that I am using objects as my data source. Which option should I go with? Am I clarifying something?
There is no alternative (or anyone!) Opinion on this matter, I have gone ahead and Come up with a workable solution.
I am opting to make logo on-demand file, storing it in a temporary location. If the file does not exist, then I am making it fly while it is present, then I am just referring to the image that exists.
In the RDLC report, I have created the parameter called path of type text. After this, in the properties of the image, I changed the image of the logo from embedded to external and for the parameter "Use this picture "Is set: [@ path].
Then, the path in the code is going through the file path as the path path parameter but where I had previously spoken wrong, that path should be a URL and I try to cross the space on the disk was doing. Therefore, that part should look like this:
ReportPermerer Paralogo = New ReportAmerator (); ParamLogo.Name = "Path"; ParamLogo.Values.Add (@ "file: ///C: \ Users \ mic \ AppData \ Local \ Temporary \ logo.png"); ReportViewer.LocalReport.SetParameters (paramLogo); I would say that MSDN documentation may be slightly better for its credit, there are several detailed documents about how to achieve something at a high level. This help clearly states that I need a URL in the path, but it is easy to check that property directly in the library. However, it was difficult and less useful to find lower level documentation. For reporting image objects here there is not much opportunity to set the properties of interest.
Comments
Post a Comment