0

i'm creating a PPTX file (Download here) using docx4j. This presentation has 1 slide and there are text boxes in it. Now when i replace the variables with the text i need somehow to calculate the maximum numbers of characters which would fit in and cut off the text when the limit is reached. Currently the text overruns out of the text box. Is this possible using the docx4j libraries ?

Thanks,

Asad

Asad Khan
  • 61
  • 6

1 Answers1

0

I don't know if docx4j offers this level of support, but PowerPoint textranges have .BoundTop, .BoundLeft, .BoundWidth and .BoundHeight properties that give you the coordinates of the imaginary bounding box that surrounds the text.

You could keep adding characters in a loop, checking the .BoundHeight after each addition, then delete the last-added character when the .BoundHeight exceeds a set limit.

Steve Rindsberg
  • 14,442
  • 1
  • 29
  • 34
  • Do you know which parameter it is in the XML file ? As i could not found .BoundHeight property in the pptx package. – Asad Khan Jun 11 '14 at 15:23
  • I suspect it's something that PPT calculates on the fly; there's no way to know the bounds until the text is displayed, and if there's font substitution, the values will change. – Steve Rindsberg Jun 11 '14 at 20:11