NAV 2013: Insert Company Logo into Report

CodingoCodingo Member Posts: 8
edited 2013-10-04 in NAV Three Tier
NAV 2013 (Update Roleup 4)

Hello Community ;)

I have a problem with a custom report. I copied the ID 405 "Order" (Purchase) to the 50.000 area. The report need the company logo inside.

This is what I have done already:

1. OnInitReport modified:
CompanyInfo.CALCFIELDS(Picture);

2. Add column to Report Dataset Designer
Under the DataItem Integer (PageLoop), I added the column:
......Data Source=CompanyInfo.Picture
......Name=CompanyInfo_Picture

3. (in VS) Added a new Matrix with a single Text Box under
<Report> <Body> <list1> <list1_Contents>
......Matrix Name: CompanyPicture

4. Changed Text Box Properties
- General:
......Name to "CompanyInfo_Picture"
......Value: "=Convert.ToBase64String(Fields!CompanyInfo_Picture.Value)"
- Visibility:
...... When the report is initially run: Hide

5. Added a new Text Box under
<Report> <Page Header>

6. Changed Text Box Properties
- General:
......Name to "DataPicture"
- Visibility:
......When the report is initially run: "Show or hide based on an expression"
.........Expression: "=Code.SetPicture(ReportItems!CompanyInfo_Picture.Value)"

7. Added Code to the Report Properties
Shared PictureData as Object

Public Function GetPicture() as Object
Return PictureData
End Function

Public Function SetPicture(NewData as Object)
If NewData > "" Then
PictureData = NewData
End If
End Function

8. Added a Image Item and modified the properties
- General
......Name: CompanyInfo_Picture1
......Select the image source: Database
......Use this field: <<Expr>>
.........Expression: "=Convert.FromBase64String(Code.GetPicture)"
......Use this MIME tpye: image/bmp


Of course the company info has an existing logo. I just get a red cross instead the company logo.

I also read the post Company Picture to RDLC report Header (NAV 2009 R2). But it don't really helped me.

Have you any ideas what I can do?


Best regards

Answers

  • urpokurpok Member Posts: 23
    What format is the company logo?
    BMP still works best, GIF, JPG etc can be problematic on reports.
    "There is no spoon."
    --Matrix

    https://navurpo.blogspot.com/?view=classic
  • CodingoCodingo Member Posts: 8
    The logo is BMP.
  • amazanamazan Member Posts: 17
    Hi Codingo,

    Try this:

    1. Add CompanyInfo.CALCFIELDS(Picture) to CopyLoop - OnAfterGetRecord
    2. Add Column CompanyInfo.Picture to Report Dataset Designer
    3. Add Image Item and modify the properties
    - General
    Name: CompanyLogo
    ......Select the image source: Database
    ......Use this field: [CompanyInfo_Picture]
    .........Expression: "=Fields!CompanyInfo_Picture.Value"
    ......Use this MIME type: image/bmp
    4. Save & Run

    :thumbsup:
  • CodingoCodingo Member Posts: 8
    Hi amazan,

    thank you for your post.

    I added the CALCFIELDS under the "CopyLoop - OnAfterGetRecord" Trigger. Now it works!

    Thanks alot \:D/
Sign In or Register to comment.