Type | Template | Report |
---|---|---|
Excel | Template | Report |
Word | Template | Report |
Word | Template | Report |
Word XML | Template | Report |
Adobe PDF | Template | Report |
xtt->MERGE( IV_BLOCK_NAME = ‘R’ IS_BLOCK =
{"TITLE"=>"Test icons", "T"=>[{"ID"=>"@00@", "NAME"=>"ICON_DUMMY", "IMG"=>"REF UNSUPPORTED", "RAW"=>""}, {"ID"=>"@01@", "NAME"=>"ICON_CHECKED", "IMG"=>"REF UNSUPPORTED", "RAW"=>""}, {"ID"=>"@02@", "NAME"=>"ICON_INCOMPLETE", "IMG"=>"REF UNSUPPORTED", "RAW"=>""}, {"ID"=>"@03@", "NAME"=>"ICON_FAILURE", "IMG"=>"REF UNSUPPORTED", "RAW"=>""}, {"ID"=>"@04@", "NAME"=>"ICON_POSITIVE", "IMG"=>"REF UNSUPPORTED", "RAW"=>""}, {"ID"=>"@05@", "NAME"=>"ICON_NEGATIVE", "IMG"=>"REF UNSUPPORTED", "RAW"=>""}, {"ID"=>"@06@", "NAME"=>"ICON_LOCKED", "IMG"=>"REF UNSUPPORTED", "RAW"=>""}, {"ID"=>"@07@", "NAME"=>"ICON_UNLOCKED", "IMG"=>"REF UNSUPPORTED", "RAW"=>""}, {"ID"=>"@0B@", "NAME"=>"ICON_TOTAL_LEFT", "IMG"=>"REF UNSUPPORTED", "RAW"=>""}, {"ID"=>"@0C@", "NAME"=>"ICON_TOTAL_RIGHT", "IMG"=>"REF UNSUPPORTED", "RAW"=>""}, {"ID"=>"@0D@", "NAME"=>"ICON_COLUMN_LEFT", "IMG"=>"REF UNSUPPORTED", "RAW"=>""}, {"ID"=>"@0E@", "NAME"=>"ICON_COLUMN_RIGHT", "IMG"=>"REF UNSUPPORTED", "RAW"=>""}, {"ID"=>"@0F@", "NAME"=>"ICON_PAGE_RIGHT", "IMG"=>"REF UNSUPPORTED", "RAW"=>""}, {"ID"=>"@0G@", "NAME"=>"ICON_PAGE_LEFT", "IMG"=>"REF UNSUPPORTED", "RAW"=>""}, {"ID"=>"@0H@", "NAME"=>"ICON_PREVIOUS_VALUE", "IMG"=>"REF UNSUPPORTED", "RAW"=>""}]}
).
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
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
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
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
Excel
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
It will be much easier to notice it in the notes.
Word
3) Pdf
Finally, the beloved Pdf & LiveCycle Designer by many developers
Could convert texts to Image fields
And it also allows, if desired, to give names in curly braces on the XML Source tab
But you can also specify it in the URL (although it is not so noticeable)