Spire.Presentation is a professional PowerPoint® compatible library that enables developers to create, read, write, modify, convert and Print PowerPoint documents. Get free and professional technical support for Spire.Presentation for .NET, Java, Android, C++, Python.

Sat Nov 30, 2024 9:05 am

Hello,
I am trying to wrap long text in paragraph and have its container to fit it.

The sample code I am using is the following but the result is not what I am expecting. As you can see, the last word is not wrapped within the container. However, if you manually open the result and toggle "Resize shape to fit the text" + "Wrap text in shape" it will fit properly.

Strange thing is that those 2 properties are already set but somehow they don't have any effect until you manually toggle them (disable then re enable)

Code: Select all
            Presentation ppt = new Presentation();
            ppt.LoadFromFile(@"test.pptx");
            var finalPpt = new Presentation();
            finalPpt.Slides.RemoveAt(0);
            finalPpt.SlideSize.Type = ppt.SlideSize.Type;
            var generatedSlide = ppt.Slides[0];

            var shape = generatedSlide.Shapes[0] as IAutoShape;

            shape.TextFrame.Paragraphs[0].Text = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin vel molestie orci, non pharetra felis. Donec accumsan facilisis magna, in interdum enim porttitor sed. Suspendisse lectus tortor, dictum nec enim et, vehicula commodo nisi. Proin lacinia tellus eu congue fermentum. Etiam id aliquam urna. Nunc viverra, ligula sed porttitor vulputate, nisl leo iaculis purus, in feugiat felis justo a nulla. Curabitur sollicitudin leo nec nisi pulvinar consectetur. Nullam at bibendum turpis. Integer elementum ante mi, ac elementum sapien vulputate ut. Cras sagittis nisi in elit sagittis tempus. Nulla et dui sed purus ultrices suscipit. Mauris sed nisl sapien. Sed lacinia consectetur nisi, ut elementum odio sodales ut. Praesent sagittis lacus sit amet elementum consectetur. Cras eleifend tristique lorem, id cursus mauris sollicitudin ut. Ut molestie venenatis ligula id laoreet.";


            finalPpt.Slides.Append(generatedSlide);

            finalPpt.SaveToFile(@"C:\temp\out.pptx", FileFormat.Pptx2013);



Is there any property we need to set on the paragrap before producing the output?
Thanks,
Andrea

andreacalvi
 
Posts: 28
Joined: Tue Jul 11, 2023 11:02 am

Mon Dec 02, 2024 6:27 am

Hello Andrea,

Thanks for your feadback.

I have reproduced the issue you encountered with your .pptx file and have logged it into our issue system with the tracking number SPIREPPT-2683.
We apologize for any inconvenience caused and will keep you updated on the progress of the issue.


Sincerely,
Amy
E-iceblue support team
User avatar

amy.zhao
 
Posts: 3043
Joined: Wed Jun 27, 2012 8:50 am

Fri Feb 07, 2025 11:53 am

Any updates?

boosted_d16
 
Posts: 50
Joined: Wed Apr 19, 2023 11:41 am

Sat Feb 08, 2025 2:55 am

Hi,

Our dev team has identified the cause of this issue and is currently in the stage of seeking a solution. Please give us some more time, and if the problem is resolved, I will give you feedback as soon as possible. Thank you for your understanding.

Sincerely,
Nina
E-iceblue support team
User avatar

Nina.Tang
 
Posts: 1385
Joined: Tue Sep 27, 2016 1:06 am

Tue Apr 15, 2025 10:02 am

I have come across the same issue. Are there any workarounds?

beyeb38077
 
Posts: 14
Joined: Mon Apr 07, 2025 2:45 pm

Wed Apr 16, 2025 8:23 am

Hello,

Thanks for your inquiry.
Your problem might be related to the topic mentioned here, but it may not be exactly the same. To allow us to better examine whether a solution exists, please share your test code and any relevant test files (if available). Thanks in advance.

Sincerely,
William
E-iceblue support team
User avatar

William.Zhang
 
Posts: 757
Joined: Mon Dec 27, 2021 2:23 am

Mon Jul 14, 2025 12:02 pm

Any updates on this issue?

boosted_d16
 
Posts: 50
Joined: Wed Apr 19, 2023 11:41 am

Tue Jul 15, 2025 7:27 am

Hello,

Thank you for your following up.
Regarding the issue SPIREPPT-2683, our dev team reported that since the algorithm used by Microsoft PowerPoint to calculate text height is not public, there is still a discrepancy between our internal code and Microsoft's in calculating text height. We have not found a suitable solution for this issue yet. We will investigate further and notify you if there is any progress. Thank you for your understanding.

Sincerely,
William
E-iceblue support team
User avatar

William.Zhang
 
Posts: 757
Joined: Mon Dec 27, 2021 2:23 am

Return to Spire.Presentation

cron