web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Answered

How to get the company logo for a customized excel export using X++

(1) ShareShare
ReportReport
Posted on by 154
I have created a personalized excel report using "OfficeOpenXml" in D365F&O. I would like to have the company logo in it. Is there anyone that could assist with this?
  • Mohamed Amine Mahmoudi Profile Picture
    26,826 Super User 2026 Season 1 on at
  • egsameera Profile Picture
    154 on at
    Hi Mohamed,
     
    It gives below errors when used the verified answer.
     
    Declaration
     
     
    Code
     
    Error
     
    Regards,
    Gihan Sameera
  • Suggested answer
    Komi Siabi Profile Picture
    13,253 Most Valuable Professional on at
  • CU02090611-0 Profile Picture
    4 on at
    Hi Komi,
     
    When click on the "Manage NuGet packages" it says unsupported. And after that the option is grayed out. 
     
     
     
    Regards,
    Gihan
     
  • Verified answer
    Martin Dráb Profile Picture
    241,467 Most Valuable Professional on at
    You can't manage NuGet packages on X++ projects - if you need NuGet, you need a C# library. But I don't think you need any. System and System.Drawing namespaces are a part of .NET Framework.
     
    A bug in your code is that you're calling FromFile as it was an instance method, but it's a static one, therefore it must be Image::FromFile(....
  • Verified answer
    egsameera Profile Picture
    154 on at
    Hi Martin,
     
    Thank you so much for the explanation and it worked.
    Below is the sample code.
     
    private void setCompanyImage(ExcelWorksheet _WorkSheet)
    {
        System.Drawing.Image image = System.Drawing.Image::FromStream(Binary::constructFromContainer(FormLetter::companyLogo()).getMemoryStream());
     
        var excelImage = _WorkSheet.Drawings.AddPicture("CompanyLogo", image);
        excelImage.SetPosition(6, 2, 5, 2);
        excelImage.SetSize(15);
    }
     
    Cheers,
    Gihan

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the August Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 544 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 347 Super User 2026 Season 2

#3
CU-1234529-002 Profile Picture

CU-1234529-002 197

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans