コード例 #1
0
        private static void EmbedCaptionsOnSlide(PowerPointSlide s)
        {
            String rawNotes = s.NotesPageText;

            if (String.IsNullOrWhiteSpace(rawNotes))
            {
                return;
            }

            var separatedNotes = SplitNotesByClicks(rawNotes);
            var captionCollection = ConvertSectionsToCaptions(separatedNotes);
            if (captionCollection.Count == 0)
            {
                return;
            }

            Shape previous = null;
            for (int i = 0; i < captionCollection.Count; i++)
            {
                String currentCaption = captionCollection[i];
                Shape captionBox = AddCaptionBoxToSlide(currentCaption, s);
                captionBox.Name = "PowerPointLabs Caption " + i;

                if (i == 0)
                {
                    s.SetShapeAsAutoplay(captionBox);
                }

                if (i != 0)
                {
                    s.ShowShapeAfterClick(captionBox, i);
                    s.HideShapeAfterClick(previous, i);
                }

                if (i == captionCollection.Count - 1)
                {
                    s.HideShapeAsLastClickIfNeeded(captionBox);
                }
                previous = captionBox;
            }
        }