I have a requirement whereby I want all the text within a table’s cells to be the same font size, especially after it has been auto-shrunk to fit. In this case, I was hoping to loop thru all table cells to determine the FontHeight and then use the smallest FontHeight to then modify all other cell’s FontHeights to the smallest. Basically, we don’t want different FontHeights for different cells as it does not look good.
When I manually set a cell’s FontHeight then it seems to return a height when I log it to console. However, if I don’t set FontHeight it returns NaN which is not very helpful.
Many presentation object formatting properties in PowerPoint documents use property inheritance from parent elements. When FontHeight returns NaN, it means that the font height is not set and is inherited from the paragraph. Typically you can use the getEffective method to retrieve the actual formatting property values. In your case: tbl.getRows().get_Item(1).get_Item(1).getTextFrame().getParagraphs().get_Item(0).getPortions().get_Item(0).getPortionFormat().getEffective().getFontHeight()
However, I still cannot effectively detect whether a table cell’s text has overflowed i.e. Slides (or Powerpoint) has applied autofit and therefore automatically reduced the font to whatever.
Basically, I’m wanting to detect when a table cell’s text has been autofit (font reduced).