I have to add a list of images to a document.
Here are the requirements
- A table (which does not exist in the document, and should be added by code) should contain these images
- table should occupy all available width in the page
- there may be one or two images per row, according to some context information.
- each column should be given 50% of the available space
- when a single image is to be added to a row, the two cells should be merged, and the image should use the full resulting space
- Images may have different sizes and aspect ratio
- images should be scaled when larger than the cell
- images should be centered (either vertically or horizontally, according to their size) in the containing cell
So actually the main issue is this: I cannot find out a way to get the effective width of the column to be able to resize the image if need be. I’ve tried to set PreferredWidth as percentage, but then all widths are always 0, both for cells and the table itself.
here is a sample of the required result
images-in-table.zip (911.4 KB)
Is it possible to get that?