I have a "template" Excel file with a few basic things set for a layout (some merged cells, some column widths, etc.), which is then used by ClosedXML to populate with data. At a basic level it's as simple as:
var workbook = new XLWorkbook(filePath);
workbook.Worksheets.Single().Cell(1, 4).Value = someTextValue;
workbook.Worksheets.Single().Cell(1, 4).Style.Alignment.WrapText = true;
// set other values, etc.
The overall process involves copying the file to another stream, returning it for download from a web app, that sort of thing.
One of the cells in the static template file has an image. Another cell on that row needs to auto-expand to fit wrapping text with carriage returns. The auto-expansion of the row works fine when setting the WrapText
property above. However, the image is also expanding its height. (Thus becoming significantly distorted.)
In the file itself I've right-clicked on the image to set its format, and under "Size & Properties" I've explicitly selected "Don't move or size with cells". However, the auto-resizing of the row taking place via the ClosedXML interaction is still causing the image to resize.
Another thing I've tried is to somehow "separate" the image from the row by putting it inside of a text box. However it would appear that both the image and the text box equally "float" above the cells and the image can't be placed inside of the text box (or I don't know how).
It appears that ClosedXML doesn't have much support for images (unless I'm just not seeing it). Is there perhaps any way in this setup to prevent this image from auto-resizing with the row?