Sometimes I think back of ‘the good old days’ of the Classic Reports in NAV. If you wanted an image anywhere on the report, you just opened the sections of the report and placed that image wherever you wanted. But of course there’s some benefits of having RTC Reports as well, like me being able to write this blog.
Placing an image in the header or footer section of an RTC report is a little more complicated, so I’d like to take you through it step by step for the scenario where you want to place the Company Logo on the Header of your report.
1. Define a global variable for table 79 ‘Company Information’, and add the ‘Company Information’.Picture as a DataSource under one of your DataItems. Since the Picture is a BLOB, don’t forget to do a CALCFIELDS.
2. After opening the Layout section of the report, add the following lines of code to the ‘Code’ Section of your Report Properties in Report Builder or Visual Studio:
3. Set the Expression property of one of the fields in the Body Section of your report to: ‘=Code.SetSignaturePic(Convert.ToBase64String(Fields!CompanyInfo_Picture.Value))’ where ‘CompanyInfo_Picture’ is the Name you assigned to the Company Logo Column when you added it under 1.
4. Add an Image report item to the Header section of your report, and set the Image Properties like this:
5. When you open up the Expression by clicking the fx button behind it, enter this as the expression: ‘=Convert.FromBase64String(Code.GetSignaturePic)’
6. If you want to make sure that the logo is displayed in a proper way, set the Sizing property of the Image to ‘FitProportional’.
And that’s all there is to it. If you want to add an Image to the Footer section of your report instead, just replace the word ‘Header’ by the word ‘Footer’ in Step 4.