none
How to change Image size in the Header section of the Report in SSRS RRS feed

  • Question

  • Hi All,

    Is there a possibility in SSRS to change the Image width/height based on Dataset in the Header section.

    (dataset will have a column for width and height of each image).

    I tried to use a container(Rectangle) and then place the image in it.

    Changed the properties on the Rectangle for height and width with no luck.

    I saw somewhere to change the code as, but I am not sure where and how to use it to set Image width and height.

    ReportName.ReportSection.ReportItem.ReportProperty.Value = x

    For example, report.DetailSection1.TextBox.Font.Value = "Arial"

    Can someone please help?

    Thank you.


    Sunny

    Friday, July 12, 2019 7:24 PM

Answers

  • Hi Sunny,

    Well, in report header, we can not directly access the dataset or field data. As work around we could use the value of textbox.

    I guess you are using some list structure or?  Well, for each page there could be one textbox that shows the member content.

    You could click the pic for image property. And set the "use this image" with expression such as:

    =SWITCH(ReportItems!Member.Value = "a", "ProductPictureA",
    ReportItems!Member.Value = "b", "ProductPictureB",
    ReportItems!Member.Value = "c", "ProductPictureC",
    ReportItems!Member.Value = "d", "ProductPictureD")

    This is for those embedded pictures. If you are using other source. You could also adjust the expression.

    Hope this helps.

    Lukas


    MSDN Community Support Please remember to click Mark as Answer; the responses that resolved your issue, and to click Unmark as Answer if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.


    Tuesday, July 16, 2019 6:57 AM

All replies

  • Hi Sunny,

    Are you working on some .net project ? Or just normal report development?

    When you set the size of image, you could choose "Fit to size", then change the size property of image in SSRS.

    See:

    And it seems the size can not be set dynamically as field from dataset.

    Or, what you mean by Header?

    Regards,

    Lukas


    MSDN Community Support Please remember to click Mark as Answer; the responses that resolved your issue, and to click Unmark as Answer if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.


    Monday, July 15, 2019 7:07 AM
  • Hi Lukas,

    Again thank you for replying.

    I am creating the report in SSRS.

    So basically I have a Report with a header section and the Image in the header section has to change dynamically.

    Yes as you pointed above the size of any item placed in a header is fixed (Rectangle,Text,Image)

    I worked around the problem by changing the Padding options on the Image which accepts an expression.

    But now I am having another issue, how to change the Image based on the ReportDataSet.

    For example I need to show 1 logo if a Member belongs to 1 Product,and then I have to show another logo if a Member belongs to another product.

    My ResultSet can have multiple members and generated report should have Multiple pages with different headers Images based on the product, the member belongs to.

    Should I post as another question, please do let me know.

    Thanks again.


    Sunny

    Monday, July 15, 2019 11:53 PM
  • Hi Sunny,

    Well, in report header, we can not directly access the dataset or field data. As work around we could use the value of textbox.

    I guess you are using some list structure or?  Well, for each page there could be one textbox that shows the member content.

    You could click the pic for image property. And set the "use this image" with expression such as:

    =SWITCH(ReportItems!Member.Value = "a", "ProductPictureA",
    ReportItems!Member.Value = "b", "ProductPictureB",
    ReportItems!Member.Value = "c", "ProductPictureC",
    ReportItems!Member.Value = "d", "ProductPictureD")

    This is for those embedded pictures. If you are using other source. You could also adjust the expression.

    Hope this helps.

    Lukas


    MSDN Community Support Please remember to click Mark as Answer; the responses that resolved your issue, and to click Unmark as Answer if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.


    Tuesday, July 16, 2019 6:57 AM
  • Hi Lukas,

    Thank you for such a brilliant solution, it worked. 

    Many thanks again !! :)


    Sunny

    Tuesday, July 16, 2019 4:56 PM