如何获得powerpoint形状的动画属性?

时间:2013-02-08 15:32:41

标签: animation properties shape

foreach (PowerPoint.AnimationSettings animation in currentslide.Shapes)
{
     getAnimation(ref XmlTextWriter xmlcreate, PowerPoint.Shape shape, int i)
}

private void getAnimation(ref XmlTextWriter xmlcreate, PowerPoint.Shape shape, int i)
    {
        xmlcreate.WriteStartElement("animation",""); //<animation id="Animasyon8" type="Animasyon" userfriendlyindex="2">
        xmlcreate.WriteAttributeString("id", "animasyon" + shape.Id);
        xmlcreate.WriteAttributeString("type", "animasyon");
        xmlcreate.WriteAttributeString("userfriendlyindex", i.ToString());
        xmlcreate.WriteElementString("duration", "1");         //<duration>1</duration>
        xmlcreate.WriteElementString("start", "0");//<start>0</start>
        xmlcreate.WriteElementString("easing", "back");//<easing>back</easing>
        xmlcreate.WriteElementString("media", shape.Id.ToString());//<media>7</media>
        xmlcreate.WriteElementString("firstpositionx", shape.TextFrame2.MarginLeft.ToString());//<firstpositionx>206</firstpositionx>
        xmlcreate.WriteElementString("firstpositiony", shape.TextFrame2.MarginBottom.ToString());//<firstpositiony>64</firstpositiony>
        xmlcreate.WriteElementString("lastpositionx", "206");//<lastpositionx>206</lastpositionx>
        xmlcreate.WriteElementString("lastpositiony", "64");//<lastpositiony>64</lastpositiony>
        xmlcreate.WriteElementString("firstwidth",shape.Width.ToString());//<firstwidth>286</firstwidth>
        xmlcreate.WriteElementString("firstheight",shape.Height.ToString());//<firstheight>115</firstheight>
        xmlcreate.WriteElementString("firstalpha", "0");//<firstalpha>0</firstalpha>
        xmlcreate.WriteElementString("lastwidth","286");//<lastwidth>286</lastwidth>
        xmlcreate.WriteElementString("lastheight", "115");//<lastheight>115</lastheight>
        xmlcreate.WriteElementString("lastalpha", "1");//<lastalpha>1</lastalpha>
        xmlcreate.WriteEndElement();//</animation>
    }
  

如何从Powerpoint形状中插入我的xml文档,获取这些信息(firstpositionx,firstpositiony,lastpositionx,lastpositiony,firstheight,firstwidth,lastheight,lastwidth,firstalpha和lastalpha)?

1 个答案:

答案 0 :(得分:0)