Quantcast
Channel: Open XML Format SDK forum
Viewing all articles
Browse latest Browse all 1288

Power Point pptx auto fit text

$
0
0

Hello!

I am writing a pptx generator. I am putting text into slides. I want that it take determine width. For excample, text "param pam pam" should take 1.5 inch. For it purpose I put <a:normAutofit /> in <a:bodyPr ..> in <p:txBody> in... slideN.xml

If generated xml text block has not enough width to contain some text, than some part of this text will be translate to next line in text block. I use <a:normAutofit /> http://msdn.microsoft.com/en-us/library/documentformat.openxml.drawing.normalautofit(v=office.14).aspx without attributes (fontScale, lnSpcReduction) because I don’t know what ratio I need in each textblock. But if I use PowerPoint application to open my generated file and after it I change some shape position, than PowerPoint automatically rebuild all text blocks on slide in a right way. As result my text "param pam pam" takes 1.5 inch.

Question is: how rebuild all text in my presentation automatically? Can I do it in XML or I need use PowerPoint COM model?

I tried to open my generated pptx throw PowerPoint COM model. Then I made some modification (text was rebuild), then I saved presentation and it looked like ok. But when I used presentation with many slides (1300 for example ), I got rebuild text only on first several slides, all other slides had “bad” text.

My next try was:  I tried to make modification throw COM model to each slide in cycle and I resaved presentation. I got document with some bad text and some good text…

Next test: I tried to do it  throw PowerPoint by hands. I opened presentation and began make changes in each few slides, the result was ok – text on all processed slides has been rebuild. After it I renamed pptx file to the zip, uncompressed it and looked on slideN.xml. I had found than PowerPoint added fontScale and lnSpcReduction attributes with different values.

How to make autofit in whole document? I hope PowerPoint COM model has some “refresh/update” method which can guaranty rebuild all text in document. Or OpenXML has some flag which can help me.

Part of my bigtest pptx you can find here

https://onedrive.live.com/redir?resid=D3D1964EFDBEF026!291&authkey=!AB68jEPGOM94Yrw&ithint=file%2c.pptx




Viewing all articles
Browse latest Browse all 1288


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>