How to get the needed height of a multi line rich-text field (any font, any font size) having defined width using Java?
问题 I am having a string of X Font(like Arial font) having Y height in define value of the width in such a way that string can comes into multiple lines. I need to calculate the required height so that required string can be fit into it. Auto size of row in Apache POI can't be possible as I require height for the rich text string(any font and height) present in merge cell of the row, in this scenario auto size doesn't work. 回答1: Found a solution using a JTextPane to render the text. Sample code