Exemplo n.º 1
0
        public void ApplyPseudoTextWhenNoTextShapes()
        {
            var isTextShapesEmpty = new TextBoxes(
                Shapes.Range(), SlideWidth, SlideHeight)
                                    .IsTextShapesEmpty();

            if (!isTextShapesEmpty)
            {
                return;
            }

            try
            {
                if (_slide.Layout == PowerPoint.PpSlideLayout.ppLayoutBlank)
                {
                    _slide.Layout = PowerPoint.PpSlideLayout.ppLayoutTitleOnly;
                }
                Shapes.AddTitle().TextFrame2.TextRange.Text = "Picture Slides Lab";
            }
            catch
            {
                // title already exist
                foreach (PowerPoint.Shape shape in Shapes)
                {
                    try
                    {
                        if (shape.Type != MsoShapeType.msoPlaceholder)
                        {
                            continue;
                        }

                        switch (shape.PlaceholderFormat.Type)
                        {
                        case PowerPoint.PpPlaceholderType.ppPlaceholderTitle:
                        case PowerPoint.PpPlaceholderType.ppPlaceholderCenterTitle:
                        case PowerPoint.PpPlaceholderType.ppPlaceholderVerticalTitle:
                            shape.TextFrame2.TextRange.Text = "Picture Slides Lab";
                            break;
                        }
                    }
                    catch (Exception e)
                    {
                        Logger.LogException(e, "ApplyPseudoTextWhenNoTextShapes");
                    }
                }
            }
        }