I am creating a spreadsheet using Open Office XML. The spreadsheet contains merged cells that contain text. In many cases, the text is longer than the size of the merged cells so it needs to wrap. I have the cell style set to wrap, but Excel ignores it. From searching on the internet, it seems that Excel ignoring "wrap' on merged cells is a long standing problem. The only workarounds that I see offered are to manually resize the rows, which would not be a problem if I were creating the spreadsheet manually.
Does anybody know a way to programmatically assess the size of a text string to figure out what the height of the row needs to be? Given a string, a font, a font size, font characteristics (bold, italics, whatever), and the width of the cell (in points or pixels), how can I compute what the height of row containing the cell needs to be so that I can see the entire string?