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

Notifications

Announcements

No record found.

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 134
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?
I have the same question (0)
  • Mohamed Amine Mahmoudi Profile Picture
    26,449 Super User 2025 Season 2 on at
  • egsameera Profile Picture
    134 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,122 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
    237,996 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
    134 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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

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

#1
Abhilash Warrier Profile Picture

Abhilash Warrier 669 Super User 2025 Season 2

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 449 Super User 2025 Season 2

#3
Martin Dráb Profile Picture

Martin Dráb 384 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans