I'm using the client-side reporting capabilities that are bundled in with Visual Studio 2010. I've got an RDLC file defined, currently with embedded images for branding purposes at the top of the report. The image is the logo for the user's company. It has nothing whatsoever to do with the report data... it's just a title.
I'd like to be able to break the dependency on embedding the images, as I'm beginning to have to scale the app. Instead, I'd like to be able to dynamically set the image. Unfortunately there is no parameter type that seems to support this.
I've looked at switching the source from embedded to external, and perhaps emitting an image file of the logo at program launch (the logo's are embedded as resources in a separate assembly), then referring to it as a generically-named file for the source. I'm not sure how much I like this option, as it seems a hack. I also get an error when testing explicitly set path images, effectively saying the object is not set to an instance. For example, I've even tried to set it to D:est.jpg, and gotten that error at design time... so I'm more reluctant to try this option.
I've also looked at calling a class in a referenced assembly from within the RDLC file, but I can't seem to get that to work. It looks like I can reference an assembly, then call via a special object called Code. Because my class is static, it should be Code.className.method, but that doesn't seem to work.
I've also considered breaking the title into a subreport, but I still don't think I've solved my dependency problem. It would still require the same amount of maintenance.
I should mention that I'm using objects as my datasource. What option should I go with? Am I missing something obvious?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…