//列出可以成为考点的属性 void listProperty(ItemObject_PPT io) { checkedListBox1.Items.Clear(); displayInfo.Clear(); switch (io.type) { case PptType.Design: PowerPoint.Design ds = (PowerPoint.Design)io.o; displayInfo.Add(new DisplayObject("Name", "Name", ds.Name)); displayInfo.Add(new DisplayObject("HasTM", "HasTM", ds.HasTitleMaster)); displayInfo.Add(new DisplayObject("Index", "Index", ds.Index)); break; case PptType.Slide: #region 幻灯片属性 PowerPoint.Slide slide = (PowerPoint.Slide)io.o; displayInfo.Add(new DisplayObject("幻灯片名称", "SlideName", slide.Name)); displayInfo.Add(new DisplayObject("幻灯片编号", "SlideIndex", slide.SlideIndex)); displayInfo.Add(new DisplayObject("幻灯片版式", "Layout", slide.Layout.ToString())); #endregion break; case PptType.Location: #region Shape名称、类型与定位属性 PowerPoint.Shape shape = (PowerPoint.Shape)io.o; displayInfo.Add(new DisplayObject("名称", "ShapeName", shape.Name)); displayInfo.Add(new DisplayObject("类型", "Type", shape.Type)); displayInfo.Add(new DisplayObject("上边距", "Top", shape.Top)); displayInfo.Add(new DisplayObject("左边距", "Left", shape.Left)); displayInfo.Add(new DisplayObject("高度", "Height", shape.Height)); displayInfo.Add(new DisplayObject("宽度", "Width", shape.Width)); //displayInfo.Add("Line:" + shape.Line.ToString()); #endregion break; case PptType.WordArt: //艺术字的一系列属性 #region 艺术字属性 PowerPoint.TextEffectFormat wordart = (PowerPoint.TextEffectFormat)io.o; //displayInfo.Add(new DisplayObject("文字", "Name", wordart.Name)); //displayInfo.Add(new DisplayObject("Type", wordart.Type)); displayInfo.Add(new DisplayObject("文字", "Text", wordart.Text)); displayInfo.Add(new DisplayObject("粗体", "Bold", wordart.FontBold)); displayInfo.Add(new DisplayObject("斜体", "Italic", wordart.FontItalic)); displayInfo.Add(new DisplayObject("字体", "FontName", wordart.FontName)); displayInfo.Add(new DisplayObject("字号", "FontSize", wordart.FontSize.ToString())); displayInfo.Add(new DisplayObject("对齐方式", "Alignment", wordart.Alignment.ToString())); displayInfo.Add(new DisplayObject("艺术字形状", "PresetShape", wordart.PresetShape.ToString())); displayInfo.Add(new DisplayObject("文字是否垂直排列", "RotatedChars", wordart.RotatedChars.ToString())); displayInfo.Add(new DisplayObject("字符间距", "Tracking", wordart.Tracking.ToString())); #endregion break; case PptType.Background: #region 背景属性 PowerPoint.ShapeRange background = (PowerPoint.ShapeRange)io.o; displayInfo.Add(new DisplayObject("填充模式", "FillType", background.Fill.Type)); displayInfo.Add(new DisplayObject("背景颜色预设填充类型", "GradientType", background.Fill.PresetGradientType)); displayInfo.Add(new DisplayObject("背景颜色预设填充方向", "GradientDegree", background.Fill.GradientStyle)); #endregion break; case PptType.Run: #region 文字块属性 PowerPoint.TextRange textrange = (PowerPoint.TextRange)io.o; displayInfo.Add(new DisplayObject("文字", "Text", textrange.Text)); displayInfo.Add(new DisplayObject("粗体", "Bold", textrange.Font.Bold)); displayInfo.Add(new DisplayObject("斜体", "Italic", textrange.Font.Italic)); displayInfo.Add(new DisplayObject("下划线", "Underline", textrange.Font.Underline)); displayInfo.Add(new DisplayObject("字体", "FontName", textrange.Font.Name)); displayInfo.Add(new DisplayObject("字号", "FontSize", textrange.Font.Size.ToString())); displayInfo.Add(new DisplayObject("字体颜色", "ForeColor", textrange.Font.Color.RGB)); displayInfo.Add(new DisplayObject("文字阴影", "Shadow", textrange.Font.Shadow)); displayInfo.Add(new DisplayObject("上标", "Superscript", textrange.Font.Superscript)); displayInfo.Add(new DisplayObject("下标", "Subscript", textrange.Font.Subscript)); #endregion break; case PptType.Animation: #region 对象自定义动画属性 PowerPoint.AnimationSettings action = (PowerPoint.AnimationSettings)io.o; displayInfo.Add(new DisplayObject("动画顺序", "AnimationOrder", action.AnimationOrder)); displayInfo.Add(new DisplayObject("进入动画效果", "EntryEffect", action.EntryEffect)); displayInfo.Add(new DisplayObject("动画触发方式", "AdvanceMode", action.AdvanceMode)); //OnTime OnClick ModeMixed(混合模式) displayInfo.Add(new DisplayObject("触发计时延迟时间", "AdvanceTime", action.AdvanceTime)); //displayInfo.Add("EntryEffect:" + action.PlaySettings.); #endregion break; case PptType.Effect: #region 幻灯片动画属性 PowerPoint.Effect effect = (PowerPoint.Effect)io.o; //displayInfo.Add("AdvanceMode:" + effect.Behaviors); //displayInfo.Add("AdvanceMode:" + effect.EffectInformation); //displayInfo.Add("AdvanceMode:" + effect.EffectParameters); displayInfo.Add(new DisplayObject("动画名称", "DisplayName", effect.DisplayName)); displayInfo.Add(new DisplayObject("动画效果", "EffectType", effect.EffectType)); displayInfo.Add(new DisplayObject("是否为退出动画", "Exit", effect.Exit)); displayInfo.Add(new DisplayObject("动画顺序", "Index", effect.Index)); displayInfo.Add(new DisplayObject("动画所作用的对象名称", "ShapeName", effect.Shape.Name)); displayInfo.Add(new DisplayObject("动画运行时间", "Duration", effect.Timing.Duration)); try { displayInfo.Add(new DisplayObject("段落", "Paragraph", effect.Paragraph)); displayInfo.Add(new DisplayObject("开始区域", "TextRangeStart", effect.TextRangeStart)); displayInfo.Add(new DisplayObject("区域长度", "TextRangeLength", effect.TextRangeLength)); } catch { } #endregion break; case PptType.Transition: //幻灯片切换的一系列属性 #region 幻灯片切换属性 PowerPoint.SlideShowTransition transition = (PowerPoint.SlideShowTransition)io.o; displayInfo.Add(new DisplayObject("是否通过点击触发", "AdvanceOnClick", transition.AdvanceOnClick)); displayInfo.Add(new DisplayObject("是否设置自动触发动画效果", "AdvanceOnTime", transition.AdvanceOnTime)); displayInfo.Add(new DisplayObject("自动触发效果延迟时间", "AdvanceTime", transition.AdvanceTime)); displayInfo.Add(new DisplayObject("幻灯片切换效果名称", "EntryEffect", transition.EntryEffect)); displayInfo.Add(new DisplayObject("切换速度", "Speed", transition.Speed)); //displayInfo.Add("声音:" + transition.SoundEffect.Name); #endregion break; case PptType.Picture: #region 图片属性 PowerPoint.PictureFormat pf = (PowerPoint.PictureFormat)io.o; //displayInfo.Add(new DisplayObject("名称", "Name", pic.Name)); //displayInfo.Add(new DisplayObject("类型", "Type", pic.Type)); //displayInfo.Add(new DisplayObject("高度", "Height", pic.Height.ToString())); //displayInfo.Add(new DisplayObject("宽度", "Width", pic.Width.ToString())); //displayInfo.Add(new DisplayObject("上边距", "Top", pic.Top.ToString())); //displayInfo.Add(new DisplayObject("左边距", "Left", pic.Left.ToString())); displayInfo.Add(new DisplayObject("左裁剪距离", "CropLeft", pf.CropLeft.ToString())); displayInfo.Add(new DisplayObject("上裁剪距离", "CropTop", pf.CropTop.ToString())); displayInfo.Add(new DisplayObject("右裁剪距离", "CropRight", pf.CropRight.ToString())); displayInfo.Add(new DisplayObject("下裁剪距离", "CropBottom", pf.CropBottom.ToString())); #endregion break; case PptType.ThreeD: #region 三维属性 PowerPoint.ThreeDFormat shape3d = (PowerPoint.ThreeDFormat)io.o; displayInfo.Add(new DisplayObject("三维效果", "ThreeDFormat", shape3d.PresetThreeDFormat)); displayInfo.Add(new DisplayObject("照明角度", "LightingDirection", shape3d.PresetLightingDirection)); displayInfo.Add(new DisplayObject("照明亮度", "LightingSoftness", shape3d.PresetLightingSoftness)); displayInfo.Add(new DisplayObject("表面效果", "Material", shape3d.PresetMaterial)); displayInfo.Add(new DisplayObject("图形深度", "Depth", shape3d.Depth)); displayInfo.Add(new DisplayObject("延伸方向", "ExtrusionDirection", shape3d.PresetExtrusionDirection)); #endregion break; case PptType.ClickAction: case PptType.MoveAction: #region 动作设置 PowerPoint.ActionSetting acs = (PowerPoint.ActionSetting)io.o; //displayInfo.Add(new DisplayObject("Verb", "ActionVerb", acs.ActionVerb)); //displayInfo.Add(new DisplayObject("AA", "AnimateAction", acs.AnimateAction)); displayInfo.Add(new DisplayObject("执行的动作", "Action", acs.Action)); if (acs.Action == PowerPoint.PpActionType.ppActionHyperlink) { if (acs.Hyperlink.Address != null) displayInfo.Add(new DisplayObject("超链接地址", "HyperlinkAddr", acs.Hyperlink.Address)); if (acs.Hyperlink.SubAddress != null) displayInfo.Add(new DisplayObject("超链接本地地址", "HyperlinkSubAddr", acs.Hyperlink.SubAddress)); } #endregion break; } foreach (DisplayObject d in displayInfo) checkedListBox1.Items.Add(d.ToString()); }
/// <summary> /// 在PPT中显示Item的方法 /// </summary> /// <param name="itm">考点信息</param> private void showSomething(ItemObject_PPT itm) { switch (itm.type) { case PptType.Slide: (itm.o as PowerPoint.Slide).Select(); break; case PptType.TextContainer: case PptType.Location: case PptType.Shape: (itm.o as PowerPoint.Shape).Select(True); break; case PptType.Run: (itm.o as PowerPoint.TextRange).Select(); break; case PptType.Effect: PowerPoint.Effect ef = itm.o as PowerPoint.Effect; (ef.Shape as PowerPoint.Shape).Select(True); break; } }
TreeNode AddNode(ItemObject_PPT itm) { TreeNode tr = new TreeNode(); tr.Tag = itm; tr.Text = itm.name; TopElement().Nodes.Add(tr); return tr; }