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; }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.PPTController); _imageView = FindViewById<BorderedImageView>(Resource.Id.panoramaImage); _txtMemo = FindViewById<TextView>(Resource.Id.txtMemo); _bottomSlideList = FindViewById<BottomHorizontalListView>(Resource.Id.bottomSlideList); _ip = Intent.GetStringExtra("ip"); _port = Intent.GetStringExtra("port"); //string document = Intent.GetStringExtra("document"); string document = App.DocumentText; if (string.IsNullOrEmpty(document) == true) { Intent i = new Intent(this, typeof(MainActivity)); i.PutExtra("ip", _ip); i.PutExtra("port", _port); StartActivity(i); } _pptDocument = Newtonsoft.Json.JsonConvert.DeserializeObject<PPTDocument>(document); if (_pptDocument != null) { LoadDocument(); } StartShow(this.SlideList[0].AnimationCount); SetSlide(0); _bottomSlideList.Adapter = new BottomItemAdapter(this, Resource.Layout.bottomRow); _imageView.SetOnTouchListener(this); }