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 :
Small and medium business | Business Central, N...
Suggested Answer

How to change pictures in Word-Layout with some functionality?

(0) ShareShare
ReportReport
Posted on by

Hello everybody,

I plan to do the following:

In BC I use Word layouts to display my reports. Now I have created a certificate that has a barcode. This barcode contains of course various data. Now I have found a DotNet library (OpenXML) that I can use to find images, etc. in a document. Now I thought that I could use something similar to find all pictures in a Word document in the future and possibly exchange them with a functionality, so that I don't have to create a new layout for every particular situation. Is there such a thing as an image exchange function? That I am able to replace the current barcode with a new one that contains more data. Have you ever seen or programmed something like this?

Thank you ;)

I have the same question (0)
  • JAngle Profile Picture
    133 on at

    For two situations. 1. Using the customer picture as my customer had to produce paperwork on behalf of their client. 2. Global dimension which resulted in a custom table based on company information.

    In both cases I've extended the report objects to call a code unit which then replaces the image passed from the company info table with the desired output.

    In both cases this worked for RDLC and word based layouts.

  • Community Member Profile Picture
    on at

    Ok, this sounds quite nice. Can you show me how you did this? Or is there an explanation in the Internet where the procedure is explained in detail?

  • Suggested answer
    JAngle Profile Picture
    133 on at

    So in the example with the dimensions I use the below codeunit function to convert the data to what I require. The concept is the same for a different variable like an item or a customer:

        procedure SetCompanyInformation(var CompanyInfo: Record "Company Information"; EntCode: Code[10]; var tmpEntityInfo: Record "Company Information (Entity)" temporary) Found: Boolean
        var
            InStr: InStream;
            OutStr: OutStream;
            CompanyEntity: Record "Company Information (Entity)";
        begin
    
            IF CompanyEntity.GET(EntCode) THEN BEGIN
                CompanyEntity.CALCFIELDS(Picture);
                tmpEntityInfo.TRANSFERFIELDS(CompanyEntity);
                IF tmpEntityInfo.INSERT THEN;
                CompanyInfo.TRANSFERFIELDS(CompanyEntity);
                Found := TRUE;
            END ELSE BEGIN
                CompanyInfo.GET;
                CompanyInfo.CALCFIELDS(Picture);
                tmpEntityInfo.TRANSFERFIELDS(CompanyInfo);
                IF tmpEntityInfo.INSERT THEN;
            END;
        end;

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 > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 3,229

#2
Jainam M. Kothari Profile Picture

Jainam M. Kothari 1,867 Super User 2025 Season 2

#3
YUN ZHU Profile Picture

YUN ZHU 1,153 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans