SSRS positioning of an image

别说谁变了你拦得住时间么 提交于 2019-12-11 12:09:59

问题


I'm developing an SSRS report where I need to place three images (company logos) at the top of the page. I get the images from three table fields. This fields can be null (images are not mandatory to be present). The locations of the images are top left, top center and top right.

I cannot find a way to align an image to the right or center. Have any of you accomplish this?


回答1:


AFAIK, it is not possible to directly do auto-align / docking. For my reports, I set the report size to fit in a standard paper size. Then, if I know the size of the image, it is easy to position it in a static manner.

If this does not work for you, it is possible to use custom code and element padding. Please see this link. HTH.




回答2:


I followed the advice on http://www.magnetismsolutions.com/blog/nathaneccles/2014/04/15/ssrs-right-and-centre-align-images-in-a-table for Padding expressions for a 'FitProportional' image control adapting slightly as I had an image coming from a database and I needed a horizontally and vertically centered image in a 7.5cm square image control (this is roughly 212pts).

Left =CSTR(round((212 - (round((System.Drawing.Image.FromStream(new System.IO.MemoryStream(CType(First(Fields!LogoColourSmall.Value, "DS_Title"), Byte()))).Width*0.75) / ((System.Drawing.Image.FromStream(new System.IO.MemoryStream(CType(First(Fields!LogoColourSmall.Value, "DS_Title"), Byte()))).Height*0.75)/212),0))) / 2, 0)) + "pt"

Top =CSTR(round((212 - (round((System.Drawing.Image.FromStream(new System.IO.MemoryStream(CType(First(Fields!LogoColourSmall.Value, "DS_Title"), Byte()))).Height*0.75) / ((System.Drawing.Image.FromStream(new System.IO.MemoryStream(CType(First(Fields!LogoColourSmall.Value, "DS_Title"), Byte()))).Width*0.75)/212),0))) / 2, 0)) + "pt"



回答3:


The easiest method I have used is to insert a 3 column matrix inside a merged cell. The image can be placed inside the middle column.




回答4:


How about putting a table at the top of your page and your images in a column of the header row? Use blank columns between the pics for space between them.

If a pic is missing, it won't affect the others.



来源:https://stackoverflow.com/questions/6819820/ssrs-positioning-of-an-image

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!