Link Search Menu Expand Document

Images

Images in a template

What is the most convenient way to show in a template that several images will be displayed in a given place?

If the template has a predetermined number of images, you can create empty images and change the content at runtime. There are no problems with changing content, because in XML-based formats images are usually stored in base64, in MS office pictures are files in certain directories in the zip archive itself. It’s pretty simple

Simple pictures

If the output is not complicated by anything and the picture in the template is a regular rectangle, you can describe the picture like other fields

image

On the ABAP side, we only need 1 additional class zcl_xtt_image. One instance of it will be the finished image

 img  TYPE REF TO zcl_xtt_image, " <--- IMAGE

When creating an object, you will need to transfer only binary data (iv_image TYPE xString)

    " Create new instance
    <ls_icon>-img = zcl_xtt_image=>create_image( iv_image  = lv_image ).

Additionally, you can transfer the size of the image and its format (extension)

    " Create new instance
    <ls_icon>-img = zcl_xtt_image=>create_image( iv_image  = lv_image
                                                     iv_ext    = '.gif'
                                                     iv_width  = lv_width
                                                     iv_height = lv_height ).

But what if we also need a picture frame and rounded edges?

Picture templates

If you add parameters in the text like that {R-T-IMG;borderColor=black;border-style=dotted} there will be a lot of such parameters and the implementation itself will be very different in pdf from Excel.

1) Excel

The easiest option is to add the ID for this field to the alternative text image

But this method is uninformative (it is simply invisible for user), and in order to make life easier for another ABAP developer, who will look for the origins of this picture, you can name the image itself in accordance with the ABAP field passed to the template

image

This will make it clearer, but to minimize the number of curses, you can make it even easier

Just specify the field along with the template for the picture in one Excel cell image


Excel

image


2) Word

Excel’s cousin also has an Alt Text field.
But is it easy to spot? Word has bookmarks and hyperlinks, but they also have the same lack image

It will be much easier to notice it in the notes. image


Word

image


3) Pdf

Finally, the beloved Pdf & LiveCycle Designer by many developers

Could convert texts to Image fields image

And it also allows, if desired, to give names in curly braces on the XML Source tab image

But you can also specify it in the URL (although it is not so noticeable)

image


Pdf

image