In my print form of a catalog (document etc.), a table with data gets printed. I want to add a picture to the righthand side of the table, and I want to add it such that the height of the picture will be equal to the height of the table. The problem is, I cannot know beforehand the exact count of lines to be show on the table, as it dynamically changes depending on which element is being printed and depending on the amount of data in the database. How can I make it so that the height of the picture dynamically matches the height of the table?
The screenshot below shows an excerpt from the print procedure from the manager module of a catalog.
Here, “Spreadsheet” refers to the document to be sent to print, it is a parameter which is automatically given to the procedure by the print wizard. In most cases, we modify the Spreadsheet via the “Template”, in our case, we won’t be using the Template for adding the picture though (as the Template do not allow changing the size of the picture dynamically), we’ll work directly on the Spreadsheet. For the picture to be shown, we do not add any areas or drawings to the Template, both the area and drawing will be addede via programming which is shown in the screenshot below.
“PictureData” refers to the Binary Data which is obtained via the AttachedFiles functionality of the default 1C configurations. If we want to show the picture on the Spreadsheet, it must be of Picture data type, that’s why in the beginning we change the Binary Data to Picture data.
The below code works right after the table gets “put” on the spreadsheet.