I want to create a presentation with data coming from a database. I manage to get valid presentations that open in PowerPoint (the Open XML Productivity Tool of the SDK 2.5 is a big help in doing this). But, how to calculate the size of the textbox shapes? I see where to put the values, but new Extents() defaults to zero width and height. When I take some values of a Shape from an existing presentation, I may get the correct height (at least for texts with one line or a fixed number of lines), but the text will overflow to the right or at the bottom (depending on wordwrap setting).
Also inserting NormalAutoFit in the BodyProperties of the TextBody doesn't help - the necessary values for FontScale and LineSpaceReduction aren't calculated in OpenXML.
So, what's best practice for setting the Extents of a Shape with a TextBody?
Is there a built-in way to calculate the Extents of a given TextBody or Shape? (some rule of thumb with built-in methods would be better than nothing)
I know that PowerPoint will recalculate the values of NormalAutoFit after any change was made (at least for a bunch of slides before and after that change), but this doesn't help when the presentation is started before a change was made (or if it was started with the PowerPoint viewer).
From Eric White's Forum
Here's the code I've come up with for my purposes based on Eric White's WmlToHtmlConverter, this post and this. I use this to calculate the dimensions of TextBox for text watermarks and for image watermarks for OpenXml for Word documents.