Spire.Presentation is a professional PowerPoint® compatible library that enables developers to create, read, write, modify, convert and Print PowerPoint documents from any .NET(C#, VB.NET, ASP.NET, .NET Core) application and Java (J2SE and J2EE) application.

Tue May 07, 2019 12:10 pm

Hello.

Is there any functionality to determine, if shape is empty?

AdamShakhabov
 
Posts: 40
Joined: Wed Sep 26, 2018 12:03 pm

Wed May 08, 2019 8:16 am

Hi,

Thank you for contacting us.
Please try the following sample code to determine if the shape is empty. If this is not what you want, please provide your input PowerPoint file for further investigation. You could send it to us via email (support@e-iceblue.com).
Code: Select all
 private static void Main(string[] args)
 {
     Presentation ppt = new Presentation();
     ppt.LoadFromFile("Presentation1.pptx");
     foreach (ISlide slide in ppt.Slides)
     {
         foreach (IAutoShape shape in slide.Shapes)
         {
             if (JudgeIfShapeIsEmpty(shape))
             {
                 Console.WriteLine("The shape is empty");
             }
             else
             {
                 Console.WriteLine("The shape is not empty");
             }
         }
     }
 }
 private static bool JudgeIfShapeIsEmpty(IAutoShape shape)
 {
     foreach (TextParagraph para in shape.TextFrame.Paragraphs)
     {
         if (!String.IsNullOrEmpty(para.Text))
         {
             return false;
         }
     }
     return true;
 }

Sincerely,
Nina
E-iceblue support team
User avatar

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

Thu May 16, 2019 1:46 am

Hello,

Greetings from E-iceblue!
Has your issue been resolved?
Thanks in advance for your valuable feedback and time.

Sincerely,
Nina
E-iceblue support team
User avatar

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

Return to Spire.Presentation