4

Here is a screenshot of some example slide. I have an animation on the word "Pizza". I am trying to find where in the string this occurs by character number.

example slide My code to grab information about the animations:

foreach (PowerPoint.Effect effect in slide.TimeLine.MainSequence)
        {
            animationMap[animationCount] = new WBLAnimation(effect,shapeMap[effect.Shape.Id],effect.TextRangeStart,effect.TextRangeStart+effect.TextRangeLength);
            animationCount++;
        }

Pizza should start at around character 11, but instead the TextRangeStart property claims that it starts around character 80. TextRangeLength is also wrong. It claims it is 71 characters in length, when it should be 6 (length of "Pizza?"). To me this seems to be counting the entire length of the textrange rather than the animated part.

WBLAnimation is just a helper class. It takes an effect, a shape, start position of the shape, and end position. This eventually needs to be refactored. This is just an example of how I am getting this information so someone might point out what I am doing wrong.

Is there another way to find where in the string the animation is occuring?

Thanks!!!

Parris
  • 17,833
  • 17
  • 90
  • 133
  • TextRangeStart, TextRangeLength etc. would be indices into the string represented by the text range (ie, Length would give you the length of the string). They're not coordinates. Beyond that I can't tell you much. – Steve Rindsberg Apr 13 '12 at 14:11
  • Not sure what you mean by "says it is 80 something". Since you can't apply animation to a single word, I'm guessing that the animation is applied to the entire text shape and set to display text a paragraph or word at a time, so when you query the length of the text range, you get the length of all the text in the shape. – Steve Rindsberg Apr 17 '12 at 03:01
  • I edited to clarify, I meant TextRangeStart claims pizza starts at character 80 or so. – Parris Apr 17 '12 at 04:03
  • The word "Pizza" does in fact animate on its own, but it is possible that this occurs since it is the entire line. I will try it tomorrow on a single word in the middle of a paragraph, but I am almost certain it will also work. – Parris Apr 17 '12 at 04:06
  • Check on Answers also. I see Shyam Pillai has answered your question there; if anyone will know the ins and outs of animation/automation, it's him. – Steve Rindsberg Apr 17 '12 at 13:22
  • Maybe you could use a `Trim()` method to find the number of characters you "cut" off before the animated part? – Liam McInroy Apr 17 '12 at 13:23
  • Also, Steve you were right, you can only animate "paragraphs" not just individual words. This makes life easier for sure. – Parris Apr 17 '12 at 19:16
  • I decide to use .paragraph to figure out what paragraph I am on, rather an animate the entire paragraph/line rather. I guess I can't animate on words any ways so that becomes a non-issue. I would never be able to figure out textrangestart anyways. Apparently it is a bug and looks at the last paragraph or something. Not sure! So yea it is solved. Thanks for the help. – Parris Apr 18 '12 at 21:03

2 Answers2

1

I believe animation always apply to objects. This means that you do NOT have an animation on the word 'Pizza'. You have an animation on the object (a textbox?) that contains the word 'Pizza'.

SPE
  • 311
  • 1
  • 7
  • You were the only one that responded as an answer. I am going to give you the bounty so it won't just disappear into nothing-ness. That being said, animations don't just apply to the "shape" objects. They also apply to things inside of textboxes. – Parris Apr 25 '12 at 00:38
0

So apparently there is a bug within powerpoint. TextRangeStart will always point out the last paragraph in the animated text range: http://answers.microsoft.com/en-us/office/forum/office_2010-powerpoint/where-can-i-find-the-start-and-end-of-the-text-in/43a16276-8abc-4cb2-9753-46c7119e7618

Now since that is the case, what I did was match up the paragraph index of the animation with the shape and find the character index from there. It is round about, but it works...

I am trying to work on work on a ppt to html converter of sorts. It uses RaphaelJS to render all of this stuff. If anyone wants to contribute check out: https://github.com/parris/tilda ... I am going to make a pretty good commit within the week.

Thanks for the help everyone.

Parris
  • 17,833
  • 17
  • 90
  • 133