Пример #1
0
        private void HighlightWords()
        {
            if (_words == null)
            {
                return;
            }
            PowerPoint.Slides slides = _presentation.Slides;
            int count = 0;

            foreach (PowerPoint.Slide slide in slides)
            {
                count++;
                PowerPoint.Shapes shapes = slide.Shapes;
                foreach (PowerPoint.Shape shape in shapes)
                {
                    if (shape.HasTextFrame == MsoTriState.msoTrue)
                    {
                        if (cmp.Compare(shape.TextFrame.TextRange.Text, _words [0].Text, CompareOptions.StringSort | CompareOptions.IgnoreCase) == 0)
                        {
                            _presentation.SlideShowWindow.View.GotoSlide(count, MsoTriState.msoTrue);
                            break;
                        }
                        //if ( shape.TextFrame.TextRange.Text.CompareTo() )
                        //_presentation.SlideShowWindow.View.GotoSlide( count, MsoTriState.msoTrue );
                        //shape.Select( MsoTriState.msoTrue );
                        //slide.MoveTo( 1 );
                        //break;
                    }
                }
            }
        }
Пример #2
0
        private string GetDocumentText(object path)
        {
            StringBuilder result = new StringBuilder();

            try
            {
                InitializePowerPoint();
                if (_powerPoint != null)
                {
                    PowerPoint.Presentation presentation =
                        _powerPoint.Presentations.Open((string)path, MsoTriState.msoTrue, MsoTriState.msoTrue, MsoTriState.msoFalse);
                    PowerPoint.Slides slides = presentation.Slides;
                    int count = slides.Count;
                    foreach (PowerPoint.Slide slide in slides)
                    {
                        PowerPoint.Shapes shapes = slide.Shapes;
                        count = shapes.Count;
                        foreach (PowerPoint.Shape shape in shapes)
                        {
                            if (shape.HasTextFrame == MsoTriState.msoTrue)
                            {
                                result.Append(shape.TextFrame.TextRange.Text).Append(" ");
                            }
                        }
                        //foreach ( PowerPoint.Comment comment in slide.Comments )
                        //{
                        //comment.Text;
                        //}
                    }
                }
            }
            catch (Exception exception)
            {
                _tracer.TraceException(exception);
            }
            ShutdownPowerPoint( );

            return(result.ToString());
        }