Beispiel #1
0
 private void insertPage(Slide slide, Size maxSize, PPTPage page, ref int objId)
 {
     insertImage(slide, maxSize, page.Cover, ++objId);
     if (null != page.PageUrlList && page.PageUrlList.Count > 0)
     {
         foreach (PageUrl pageUrl in page.PageUrlList)
         {
             insertLink(slide, pageUrl, ++objId);
         }
     }
 }
Beispiel #2
0
        public PPTDocument ReadAll(int width, int height)
        {
            if (Directory.Exists(_tempPath) == false)
            {
                return(null);
            }

            int slideNumber = 0;

            List <string> files = new List <string>();

            files.AddRange(Directory.GetFiles(_tempPath));

            files.Sort(CompareOnlyNumbers);

            PPTDocument document = new PPTDocument();

            for (int i = 1; i <= _current.Slides.Count; i++)
            {
                Slide slide = null;

                try
                {
                    slide = _current.Slides[i];
                }
                catch
                {
                }

                if (slide == null)
                {
                    continue;
                }

                string note           = string.Empty;
                int    animationCount = 0;

                SlideRange nodePath = null;

                try
                {
                    nodePath = slide.NotesPage;
                }
                catch { }

                if (nodePath != null)
                {
                    foreach (Shape shape in nodePath.Shapes)
                    {
                        PpPlaceholderType currentType = PpPlaceholderType.ppPlaceholderObject;

                        try
                        {
                            currentType = shape.PlaceholderFormat.Type;
                        }
                        catch { }

                        if (currentType == PpPlaceholderType.ppPlaceholderBody)
                        {
                            if (shape.HasTextFrame == Microsoft.Office.Core.MsoTriState.msoTrue)
                            {
                                if (shape.TextFrame.HasText == Microsoft.Office.Core.MsoTriState.msoTrue)
                                {
                                    note += shape.TextFrame.TextRange.Text;
                                }
                            }
                        }

                        AnimationSettings animationSettings = null;

                        try
                        {
                            animationSettings = shape.AnimationSettings;

                            if (animationSettings.Animate == Microsoft.Office.Core.MsoTriState.msoTrue)
                            {
                                animationCount++;
                            }
                        }
                        catch { }
                    }
                }

                try
                {
                    foreach (Effect effect in slide.TimeLine.MainSequence)
                    {
                        if (effect.Timing.TriggerType == MsoAnimTriggerType.msoAnimTriggerOnPageClick)
                        {
                            animationCount++;
                        }
                    }
                }
                catch { }

                PPTPage page = new PPTPage();
                page.Note           = note;
                page.ImageAsText    = ConvertToImage(files[slideNumber], width, height);
                page.AnimationCount = animationCount;

                slideNumber++;

                document.List.Add(page);
            }

            document.Count  = document.List.Count;
            document.Width  = width;
            document.Height = height;
            return(document);
        }