/// <summary> /// 在PPT中显示Item的方法 /// </summary> /// <param name="itm">考点信息</param> private void showSomething(ItemObject itm) { switch (itm.type) { case PptType.Slide: (itm.o as PowerPoint.Slide).Select(); break; case PptType.TextContainer: case PptType.EmbeddedObject: case PptType.WordArt: case PptType.Picture: (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; } }
//列出可以成为考点的属性 void listProperty(ItemObject io) { checkedListBox1.Items.Clear(); switch (io.type) { case PptType.Slide: { PowerPoint.Slide slide = (PowerPoint.Slide)io.o; checkedListBox1.Items.Add("Name:" + slide.Name); checkedListBox1.Items.Add("SlideID:" + slide.SlideID); checkedListBox1.Items.Add("SlideIndex:" + slide.SlideIndex); checkedListBox1.Items.Add("SlideNumber:" + slide.SlideNumber); checkedListBox1.Items.Add("Layout:" + slide.Layout.ToString()); break; } case PptType.EmbeddedObject: case PptType.TextContainer: { PowerPoint.Shape shape = (PowerPoint.Shape)io.o; checkedListBox1.Items.Add("Name:" + shape.Name); checkedListBox1.Items.Add("Type:" + shape.Type); checkedListBox1.Items.Add("Top:" + shape.Top.ToString()); checkedListBox1.Items.Add("Left:" + shape.Left.ToString()); //checkedListBox1.Items.Add("Line:" + shape.Line.ToString()); break; } case PptType.WordArt: //艺术字的一系列属性 { #region 艺术字属性 PowerPoint.Shape shape = (PowerPoint.Shape)io.o; checkedListBox1.Items.Add("Name:" + shape.Name); checkedListBox1.Items.Add("Type:" + shape.Type); checkedListBox1.Items.Add("Height:" + shape.Height.ToString()); checkedListBox1.Items.Add("Width:" + shape.Width.ToString()); checkedListBox1.Items.Add("Top:" + shape.Top.ToString()); checkedListBox1.Items.Add("Left:" + shape.Left.ToString()); checkedListBox1.Items.Add("Text:" + shape.TextEffect.Text); checkedListBox1.Items.Add("FontBold:" + shape.TextEffect.FontBold); checkedListBox1.Items.Add("FontItalic:" + shape.TextEffect.FontItalic); checkedListBox1.Items.Add("FontName:" + shape.TextEffect.FontName); checkedListBox1.Items.Add("FontSize:" + shape.TextEffect.FontSize.ToString()); checkedListBox1.Items.Add("Alignment:" + shape.TextEffect.Alignment.ToString()); checkedListBox1.Items.Add("PresetTextEffect(格式):" + shape.TextEffect.PresetTextEffect.ToString()); checkedListBox1.Items.Add("PresetShape(形状):" + shape.TextEffect.PresetShape.ToString()); checkedListBox1.Items.Add("RotatedChars(文字是否垂直排列):" + shape.TextEffect.RotatedChars.ToString()); checkedListBox1.Items.Add("Tracking(字符间距):" + shape.TextEffect.Tracking.ToString()); //checkedListBox1.Items.Add("是否自动缩紧字符对:" + shape.TextEffect.KernedPairs.ToString()); #endregion break; } case PptType.Background: { #region 背景属性 PowerPoint.ShapeRange background = (PowerPoint.ShapeRange)io.o; checkedListBox1.Items.Add("Fill(填充模式):" + background.Fill.Type); checkedListBox1.Items.Add("GradientType(背景颜色预设填充):" + background.Fill.PresetGradientType); checkedListBox1.Items.Add("GradientDegree(背景颜色预设填充方向):" + background.Fill.GradientStyle); #endregion break; } case PptType.Design: { PowerPoint.Design design = ((PowerPoint.Design)io.o); //checkedListBox1.Items.Add("Name:" + design.Name); //checkedListBox1.Items.Add("HasTitleMaster:" + design.HasTitleMaster.ToString()); break; } case PptType.Master: { break; } case PptType.Run: { #region 文字块属性 PowerPoint.TextRange textrange = (PowerPoint.TextRange)io.o; checkedListBox1.Items.Add("Text:" + textrange.Text); checkedListBox1.Items.Add("Bold:" + textrange.Font.Bold); checkedListBox1.Items.Add("Italic:" + textrange.Font.Italic); checkedListBox1.Items.Add("Underline:" + textrange.Font.Underline); checkedListBox1.Items.Add("FontName:" + textrange.Font.Name); checkedListBox1.Items.Add("FontSize:" + textrange.Font.Size.ToString()); checkedListBox1.Items.Add("ForeColor:" + textrange.Font.Color.RGB); checkedListBox1.Items.Add("Shadow(文字阴影):" + textrange.Font.Shadow); checkedListBox1.Items.Add("Superscript(上标):" + textrange.Font.Superscript); checkedListBox1.Items.Add("Subscript(下标):" + textrange.Font.Subscript); #endregion break; } case PptType.Action: { #region Action属性 try { PowerPoint.AnimationSettings action = (PowerPoint.AnimationSettings)io.o; checkedListBox1.Items.Add("AdvanceMode:" + action.AdvanceMode); checkedListBox1.Items.Add("AdvanceTime:" + action.AdvanceTime); checkedListBox1.Items.Add("AfterEffect:" + action.AfterEffect); checkedListBox1.Items.Add("Animate:" + action.Animate); checkedListBox1.Items.Add("AnimateBackground:" + action.AnimateBackground); checkedListBox1.Items.Add("AnimateTextInReverse:" + action.AnimateTextInReverse); checkedListBox1.Items.Add("AnimationOrder:" + action.AnimationOrder); checkedListBox1.Items.Add("ChartUnitEffect:" + action.ChartUnitEffect); checkedListBox1.Items.Add("DimColor:" + action.DimColor.RGB); checkedListBox1.Items.Add("EntryEffect:" + action.EntryEffect); checkedListBox1.Items.Add("SoundEffect:" + action.SoundEffect); checkedListBox1.Items.Add("TextLevelEffect:" + action.TextLevelEffect); checkedListBox1.Items.Add("TextUnitEffect:" + action.TextUnitEffect); //checkedListBox1.Items.Add("EntryEffect:" + action.PlaySettings.); } catch { } #endregion break; } case PptType.Effect: { #region 动画属性 PowerPoint.Effect effect = (PowerPoint.Effect)io.o; //checkedListBox1.Items.Add("AdvanceMode:" + effect.Behaviors); //checkedListBox1.Items.Add("AdvanceMode:" + effect.EffectInformation); //checkedListBox1.Items.Add("AdvanceMode:" + effect.EffectParameters); checkedListBox1.Items.Add("DisplayName(动画名称):" + effect.DisplayName); checkedListBox1.Items.Add("EffectType(动画类型):" + effect.EffectType); checkedListBox1.Items.Add("Exit(是否为退出动画):" + effect.Exit); checkedListBox1.Items.Add("Index(动画顺序):" + effect.Index); checkedListBox1.Items.Add("ShapeName(矩形区域):" + effect.Shape.Name); checkedListBox1.Items.Add("Duration(动画运行时间):" + effect.Timing.Duration); try { checkedListBox1.Items.Add("Paragraph(段落):" + effect.Paragraph); checkedListBox1.Items.Add("TextRangeStart(开始区域):" + effect.TextRangeStart); checkedListBox1.Items.Add("TextRangeLength(区域长度):" + effect.TextRangeLength); } catch { } #endregion break; } case PptType.Transition: //幻灯片切换的一系列属性 { #region 幻灯片切换属性 PowerPoint.SlideShowTransition transition = (PowerPoint.SlideShowTransition)io.o; checkedListBox1.Items.Add("AdvanceOnClick(是否点击触发):" + transition.AdvanceOnClick); checkedListBox1.Items.Add("AdvanceOnTime(是否时间触发):" + transition.AdvanceOnTime); checkedListBox1.Items.Add("AdvanceTime(时间提前):" + transition.AdvanceTime); checkedListBox1.Items.Add("EntryEffect(效果):" + transition.EntryEffect); checkedListBox1.Items.Add("Speed(速度):" + transition.Speed); //checkedListBox1.Items.Add("声音:" + transition.SoundEffect.Name); #endregion break; } case PptType.Picture: { #region 图片属性 PowerPoint.Shape shape = (PowerPoint.Shape)io.o; PowerPoint.PictureFormat pf = shape.PictureFormat; checkedListBox1.Items.Add("Name:" + shape.Name); checkedListBox1.Items.Add("Type:" + shape.Type); checkedListBox1.Items.Add("Height:" + shape.Height.ToString()); checkedListBox1.Items.Add("Width:" + shape.Width.ToString()); checkedListBox1.Items.Add("Top:" + shape.Top.ToString()); checkedListBox1.Items.Add("Left:" + shape.Left.ToString()); checkedListBox1.Items.Add("CropLeft(左裁剪距离):" + pf.CropLeft.ToString()); checkedListBox1.Items.Add("CropTop(上裁剪距离):" + pf.CropTop.ToString()); checkedListBox1.Items.Add("CropRight(右裁剪距离):" + pf.CropRight.ToString()); checkedListBox1.Items.Add("CropBottom(下裁剪距离):" + pf.CropBottom.ToString()); #endregion break; } } }
TreeNode AddNode(ItemObject itm) { TreeNode tr = new TreeNode(); tr.Tag = itm; tr.Text = itm.name; TopElement().Nodes.Add(tr); return tr; }
//列出可以成为考点的属性 void listProperty(ItemObject 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()); }