0

I add text to a pptx slide, and wan't it to be aligned properly.

i use the following code

placing = (slide.width/2,0,slide.width/4,0)
txBox = slide.shapes.add_textbox(placing[0], placing[1], placing[2], placing[3])
tf = txBox.text_frame
tf.margin_left = 0
tf.text = text

it works, but the location is not consistent, the text starts at a different "left" location when the text grown longer or shorter.

what am i missing here?

is it possible that the text frame grows larger when the text is longer and than it's "left" value is changing? in that case, how can i force the text to fit some arbitrary dimensions?

thanks

thebeancounter
  • 4,261
  • 8
  • 61
  • 109
  • It would help if you added enough code to make the script reproduce your problem. – Martin Evans Dec 13 '16 at 12:15
  • What XML do you get when you `print(txBox._element.xml)`? Does that change when you open the .pptx and save it with PowerPoint? Try making the height non-zero. That could be causing PowerPoint to make adjustments when you load the file. – scanny Dec 13 '16 at 22:21

0 Answers0